public object Options([FromBody] FAQ model) { if (string.IsNullOrWhiteSpace(model.faqtitle) || string.IsNullOrWhiteSpace(model.faqcontent)) { return(new { result = Result.ValueCanNotBeNull }); } if (!Regex.IsMatch(model.faqtitle, @"^[\u0391-\uFFE5a-zA-Z_]\w{3,64}")) { return(new { result = Result.AccountOnlyConsistOfLettersAndNumbers }); } if (!Regex.IsMatch(model.faqcontent, @"^[\u0391-\uFFE5a-zA-Z_]\w{3,300}")) { return(new { result = Result.AccountOnlyConsistOfLettersAndNumbers }); } FAQ mi = FAQBLL.GetModelByID(model); mi.faqtitle = model.faqtitle; mi.faqcontent = model.faqcontent; int result = FAQBLL.Update(mi); if (result > 0) { return(new { result = 0 }); } return(new { result = 4 }); }
public object Put([FromBody] FAQ model) { if (string.IsNullOrWhiteSpace(model.faqtitle) || string.IsNullOrWhiteSpace(model.faqcontent)) { return(new { result = Result.ValueCanNotBeNull }); } if (!Regex.IsMatch(model.faqtitle, @"^[\u0391-\uFFE5a-zA-Z_]\w{3,64}")) { return(new { result = Result.AccountOnlyConsistOfLettersAndNumbers }); } if (!Regex.IsMatch(model.faqcontent, @"^[\u0391-\uFFE5a-zA-Z_]\w{3,300}")) { return(new { result = Result.AccountOnlyConsistOfLettersAndNumbers }); } model.faqtype = 1; model.operdate = DateTime.Now; int result = FAQBLL.Add(model); if (result > 0) { return(new { result = 0 }); } return(new { result = 4 }); }
public object Delete([FromBody] FAQ model) { int result = FAQBLL.Delete(model); if (result > 0) { return(new { result = 0 }); } return(new { result = 1 }); }
public ActionResult CommonProblemsForUpdate(Dictionary <string, string> queryvalues) { int page = queryvalues.ContainsKey("page") ? Convert.ToInt32(queryvalues["page"]) : 1; int id = queryvalues.ContainsKey("id") ? Convert.ToInt32(queryvalues["id"]) : 0; FAQ model = FAQBLL.GetModelByID(new FAQ { Id = id }); if (model == null) { return(RedirectToAction("CommonProblems")); } return(View(model)); }
public ActionResult CommonProblems(Dictionary <string, string> queryvalues) { int page = queryvalues.ContainsKey("page") ? Convert.ToInt32(queryvalues["page"]) : 1; string leftMenuMark = queryvalues.ContainsKey("leftMenuMark") ? queryvalues["leftMenuMark"] : string.Empty; if (leftMenuMark != "leftMenu") { if (Request.IsAjaxRequest()) { return(PartialView("CommonProblems_PageList", FAQBLL.GetListByPage(page))); } PagedList <FAQ> model = FAQBLL.GetListByPage(page); return(View(model)); } else { PagedList <FAQ> model = FAQBLL.GetListByPage(page); return(View(model)); } }
public ActionResult FAQ(Dictionary <string, string> queryvalues) { IEnumerable <FAQ> model = FAQBLL.GetList(); return(View(model)); }