public Response<string> ReportSpam(ReportSpamModel objReq) { Response<string> response = new Response<string>(); List<string> objResp = new List<string>(); try { RequestMethods objDBMethod = new RequestMethods(); if (CheckRequestIsvalidornot(this.Request)) { if (ModelState.IsValid) { if (objDBMethod.ReportSpam(objReq)) response.Create(true, Messages.FormatMessage(Messages.Success, "You have spammed"), Messages.AppVersion, objResp); else response.Create(false, Messages.FormatMessage(Messages.InvalidReq), Messages.AppVersion, objResp); } else response.Create(false, ModelState.Values.FirstOrDefault().Errors.FirstOrDefault().ErrorMessage, Messages.AppVersion, objResp); } else response.Create(false, Messages.FormatMessage(Messages.InvalidReq), Messages.AppVersion, objResp); } catch (Exception ex) { object session = new JavaScriptSerializer().Serialize(objReq); LogManager.Error("Error occured while Processing Webservice request :{0}", ex, session, ex.Message); response.Create(false, Messages.FormatMessage(Messages.ErrorOccure), Messages.AppVersion, objResp); } return response; }
public Response<string> SaveTutorProfile() { TutorProfile objReq = new TutorProfile(); Response<string> response = new Response<string>(); List<string> objResp = new List<string>(); int resp = 0; try { RequestMethods objDBMethod = new RequestMethods(); if (CheckRequestIsvalidornot(this.Request)) { HttpContextWrapper objwrapper = GetHttpContext(this.Request); HttpFileCollectionBase collection = objwrapper.Request.Files; string jsonvalue = objwrapper.Request.Form["json"]; if (!string.IsNullOrEmpty(jsonvalue)) { objReq = JsonConvert.DeserializeObject<TutorProfile>(jsonvalue); objReq.fileName = SaveFile(collection, objReq.fileName); if (objReq.fileName == "") response.Create(false, Messages.InvalidFormat, Messages.AppVersion, objResp); else resp = objDBMethod.SaveTutorProfile(objReq); if (resp == 1) { response.Create(true, "Profile saved successfully", Messages.AppVersion, objResp); } else { response.Create(false, Messages.FormatMessage(Messages.ErrorOccure), Messages.AppVersion, objResp); } } } } catch (Exception ex) { object session = new JavaScriptSerializer().Serialize(objReq); LogManager.Error("Error occured while Processing Webservice request :{0}", ex, session, ex.Message); response.Create(false, Messages.FormatMessage(Messages.ErrorOccure), Messages.AppVersion, objResp); } return response; }