Exemplo n.º 1
0
        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));
        }
Exemplo n.º 2
0
 public ActionResult Create(Faq @faq)
 {
     if (ModelState.IsValid)
     {
         faqService.Insert(@faq);
         faqService.Commit();
         SuccessMessage(FormMessages.SaveSuccess);
         return(RedirectToAction("Index"));
     }
     return(View(@faq));
 }
Exemplo n.º 3
0
        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));
        }
Exemplo n.º 4
0
        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));
            }
        }