public async Task <IActionResult> Insert([FromBody] FaqMeta faqMeta) { var result = await _faqService.Insert(CurrentUser.TenantId, CurrentUser.Id, CurrentUser.FullName, CurrentUser.Avatar, faqMeta); if (result.Code <= 0) { return(BadRequest(result)); } return(Ok(result)); }
public ActionResult Create(Faq @faq) { if (ModelState.IsValid) { faqService.Insert(@faq); faqService.Commit(); SuccessMessage(FormMessages.SaveSuccess); return(RedirectToAction("Index")); } return(View(@faq)); }
public HttpResponseMessage AddFaq(FaqAddRequest model) { if (!ModelState.IsValid && model != null) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState)); } ItemResponse <int> response = new ItemResponse <int>(); response.Item = _faqService.Insert(model); return(Request.CreateResponse(HttpStatusCode.OK, model)); }
public HttpResponseMessage Add(FAQAddRequest model) { // if the Model does not pass validation, there will be an Error response returned with errors if (!ModelState.IsValid) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState)); } ItemResponse <int> response = new ItemResponse <int>(); response.Item = _faqService.Insert(model); return(Request.CreateResponse(response)); }
public HttpResponseMessage Insert(FaqAddRequest model) { try { ItemResponse <int> response = new ItemResponse <int>(); response.Item = _faqService.Insert(model); return(Request.CreateResponse(HttpStatusCode.OK, response)); } catch (Exception ex) { _errorService.LogError(ex); return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex)); } }