本文整理汇总了C#中Response.Create方法的典型用法代码示例。如果您正苦于以下问题:C# Response.Create方法的具体用法?C# Response.Create怎么用?C# Response.Create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Response
的用法示例。
在下文中一共展示了Response.Create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddComment
public Response<bool> AddComment(ReqAddComment objreq)
{
bool rst = false;
var objresponse = new Response<bool>();
var objmethod = new UnseenTalentsMethod();
try
{
rst = objmethod.SaveVideoComments(objreq);
objresponse.Create(true, 0, "Events for admin", rst);
}
catch (Exception ex)
{
objresponse.Create(false, -1, "", rst);
}
return objresponse;
}
示例2: AdminLogin
public Response<byte> AdminLogin(LoginModel Data)
{
var objresponse = new Response<byte>();
var unSeenTalentsMethod = new UnseenTalentsMethod();
if (Data != null)
{
using (var db = new UnseentalentdbDataContext())
{
User user = db.Users.FirstOrDefault(t => t.Email == Data.Email && t.Password == Data.Password);
byte result = 0;
if (user != null)
{
var currentUser = new CurrentUser
{
Email = user.Email,
FirstName = user.FirstName,
isEmailVerify = true,
LastName = user.LastName,
ProfilePic = user.ProfilePic,
userid = user.Id,
userrole = unSeenTalentsMethod.GetUserRole(user.Id),
};
string json = JsonConvert.SerializeObject(currentUser);
FormsAuthentication.SetAuthCookie(json, Data.RememberMe);
result = 2; //sucess login
objresponse.Create(true, 0, "Admin login successfully", result);
}
else
{
result = 0; //Username password not valid
objresponse.Create(false, 1, "Admin login Failed", result);
}
}
}
return objresponse;
}
示例3: UserLogin
public Response<byte> UserLogin(LoginModel Data)
{
var objresponse = new Response<byte>();
var unSeenTalentsMethod = new UnseenTalentsMethod();
byte result = 0;
if (Data != null)
{
// string pwd = Encryption.Encrypt(Data.Password, ConstantValues.EncryptionKey);
using (var db = new UnseentalentdbDataContext())
{
User user =
db.Users.FirstOrDefault(
t =>
(t.Email == Data.Email || t.UserName == Data.Email) && t.IsActive == true &&
t.IsDeleted == false);
if (user != null)
{
if (user.Password == Data.Password)
{
var objmethod = new UnseenTalentsMethod();
var currentUser = new CurrentUser
{
Email = user.Email,
FirstName = user.UserName,
isEmailVerify = true,
LastName = user.LastName,
ProfilePic = objmethod.ReturnProfilePicture(user.ProfilePic),
userid = user.Id,
isToken = user.IsToken != null && Convert.ToBoolean(user.IsToken),
userrole = unSeenTalentsMethod.GetUserRole(user.Id)
};
string json = JsonConvert.SerializeObject(currentUser);
FormsAuthentication.SetAuthCookie(json, Data.RememberMe);
result = 2; //sucess login
objresponse.Create(true, 0, "User login successfully", result);
}
else
{
result = 0; //Username password not valid
objresponse.Create(false, 1, "User login successfully", result);
}
}
else
{
result = 0;
objresponse.Create(false, 1, "User login successfully", result);
}
}
}
return objresponse;
}
示例4: subscribeNewsLetter
public Response<string> subscribeNewsLetter(ReqNewsLetter objnewsLetter)
{
var response = new Response<string>();
string rst = "";
try
{
var objmethod = new UnseenTalentsMethod();
rst = objmethod.SubscribeNewsLetter(objnewsLetter);
if (rst == "1")
{
response.Create(true, 1, "Subscripe successfully", rst);
}
else
{
response.Create(false, 1, "Subscripe successfully", rst);
}
}
catch (Exception ex)
{
response.Create(false, -1, Messages.FormatMessage(ex.Message), "0");
}
finally
{
// return response;
}
return response;
}
示例5: SaveUploadedFileDetails
public Response<int> SaveUploadedFileDetails(UploadedFile model)
{
int rst = 0;
var objresponse = new Response<int>();
var objmethod = new UnseenTalentsMethod();
try
{
rst = objmethod.SaveUploadedFileDetails(model);
objresponse.Create(true, 0, rst == 1 ? "Video has been upload" : "Video failed to upload", rst);
}
catch (Exception ex)
{
objresponse.Create(false, -1, "", rst);
}
return objresponse;
}
示例6: SavePost
public Response<string> SavePost()
{
var response = new Response<string>();
string rst = "";
try
{
HttpContextWrapper objwrapper = GetHttpContext(Request);
HttpFileCollectionBase collection = objwrapper.Request.Files;
string jsonvalue = objwrapper.Request.Form["json"];
if (!string.IsNullOrEmpty(jsonvalue))
{
var objitem = JsonConvert.DeserializeObject<ReqSaveEventPost>(jsonvalue);
objitem.file = "";
//int count = 0;
foreach (string file in collection)
{
HttpPostedFileBase file1 = collection.Get(file);
// HttpPostedFileBase file1 = collection.Get(file);
if (file1.ContentType == "video/quicktime" || file1.ContentType == "video/mp4")
{
var videofile = new byte[file1.ContentLength];
file1.InputStream.Read(videofile, 0, file1.ContentLength);
BinaryWriter Writer = null;
if (videofile.Length > 0)
{
string videoname = Guid.NewGuid().ToString().Substring(0, 7) + "_.MOV";
if (file1.ContentType == "video/mp4")
{
videoname = Guid.NewGuid().ToString().Substring(0, 7) + "_.mp4";
}
Writer =
new BinaryWriter(
File.OpenWrite(HttpContext.Current.Request.PhysicalApplicationPath +
"WebImages\\Video\\" + videoname));
Writer.Write(videofile);
Writer.Flush();
Writer.Close();
objitem.file = videoname;
// count = 1;
}
}
}
var objmethod = new UnseenTalentsMethod();
rst = objmethod.SaveEventPost(objitem);
response.Create(true, 1, "User login successfully", rst);
}
else
{
response.Create(false, 1, "Data not found.", "0");
}
}
catch (Exception ex)
{
response.Create(false, -1, Messages.FormatMessage(ex.Message), "0");
}
return response;
}
示例7: SaveEditEvents
public Response<bool> SaveEditEvents(GetAllevents objreq)
{
bool rst = false;
var objresponse = new Response<bool>();
var objmethod = new UnseenTalentsMethod();
try
{
rst = objmethod.SaveEditEvents(objreq);
objresponse.Create(true, 0, "Events for admin", rst);
}
catch (Exception ex)
{
objresponse.Create(false, -1, "", rst);
}
return objresponse;
}
示例8: postVote
public Response<string> postVote(ReqVote objReq)
{
var response = new Response<string>();
string rst = "";
try
{
var objmethod = new UnseenTalentsMethod();
rst = objmethod.PostVote(objReq);
if (rst == "1")
{
response.Create(true, 1, "successfully", rst);
}
else
{
response.Create(false, 1, "Invalid request", rst);
}
}
catch (Exception ex)
{
response.Create(false, -1, Messages.FormatMessage(ex.Message), "0");
}
finally
{
// return response;
}
return response;
}
示例9: EventAction
public Response<string> EventAction(ActionModel model)
{
var response = new Response<string>();
string value = "";
var obj = new UnseenTalentsMethod();
value = obj.EventAction(model);
if (value == "1")
{
response.Create(true, 0, Messages.delete, value);
}
else if (value == "2")
{
response.Create(true, 0, Messages.block, value);
}
else if (value == "3")
{
response.Create(true, 0, Messages.unBlock, value);
}
else
{
response.Create(false, 0, Messages.INVALID_REQ, value);
}
return response;
}
示例10: GetVideoComments
public Response<List<RespGetVideoComments>> GetVideoComments(ReqGetVideoComments objReq)
{
var objresponse = new Response<List<RespGetVideoComments>>();
var objlist = new List<RespGetVideoComments>();
var objmethod = new UnseenTalentsMethod();
try
{
objlist = objmethod.GetVideoComments(objReq);
objresponse.Create(true, 0, "Events for admin", objlist);
}
catch (Exception ex)
{
objresponse.Create(false, -1, "Events for admin", objlist);
}
return objresponse;
}
示例11: GetEventsforSearch
public Response<List<RespEventForSearch>> GetEventsforSearch(ReqSearch objSearch)
{
var objresponse = new Response<List<RespEventForSearch>>();
var objlist = new List<RespEventForSearch>();
var objmethod = new UnseenTalentsMethod();
try
{
objlist = objmethod.GetEventsforSearch(objSearch);
objresponse.Create(true, 0, "Events for admin", objlist);
}
catch (Exception ex)
{
objresponse.Create(false, -1, "Events for admin", objlist);
}
return objresponse;
}
示例12: GetAvaliableTokenForUser
public Response<List<TokenModel>> GetAvaliableTokenForUser()
{
var objresponse = new Response<List<TokenModel>>();
var objlist = new List<TokenModel>();
var objmethod = new UnseenTalentsMethod();
try
{
objlist = objmethod.GetAvaliableTokenByUserId();
if (objlist.Any())
{
objresponse.Create(true, 0, "Events for admin", objlist);
}
else
{
objresponse.Create(false, 1, "Events for admin", objlist);
}
}
catch (Exception ex)
{
objresponse.Create(false, -1, "Events for admin", objlist);
}
return objresponse;
}
示例13: GetAllevntsforWeb
public Response<List<getEventModel>> GetAllevntsforWeb()
{
var objresponse = new Response<List<getEventModel>>();
var objlist = new List<getEventModel>();
var objmethod = new UnseenTalentsMethod();
try
{
objlist = objmethod.GetAllevntsforWeb();
objresponse.Create(true, 0, "Events for admin", objlist);
}
catch (Exception ex)
{
objresponse.Create(false, -1, "Events for admin", objlist);
}
return objresponse;
}
示例14: GetAllEventsForVideoUpload
public Response<GetEventResponse> GetAllEventsForVideoUpload(object objreq)
{
var objresponse = new Response<GetEventResponse>();
var objlist = new List<GetAllevents>();
var objmethod = new UnseenTalentsMethod();
var objeventresp = new GetEventResponse();
try
{
objeventresp.EventList = objmethod.GetAllEventsForVideoUpload();
if (objeventresp.EventList.Any())
{
objeventresp.total = objeventresp.EventList.Count();
objresponse.Create(true, 0, "Events for admin", objeventresp);
}
else
{
objeventresp.total = 0;
objresponse.Create(false, 1, "Events for admin", objeventresp);
}
}
catch (Exception ex)
{
objeventresp.total = 0;
objresponse.Create(false, -1, "Events for admin", objeventresp);
}
return objresponse;
}
示例15: GetAllCategories
public Response<List<CategoryModel>> GetAllCategories()
{
var objresponse = new Response<List<CategoryModel>>();
var objlist = new List<CategoryModel>();
var objmethod = new UnseenTalentsMethod();
try
{
objlist = objmethod.GetAllEventCategories();
objresponse.Create(true, 0, "All Event Categories", objlist);
}
catch (Exception ex)
{
objresponse.Create(false, -1, "No Event Categories", objlist);
}
return objresponse;
}