示例#1
0
        public ActionResult Add(FaqModel model)
        {
            if (ModelState.IsValid)
            {
                Faq faq = new Faq();
                faq.UpdateModel(model);
                UpdateResult result = _faqService.Add(faq);
                if (result.State == 1)
                {
                    ViewBag.Completed = true;
                }
                else
                {
                    ViewBag.Completed = false;
                }
            }

            return(View(model));
        }
示例#2
0
        public ActionResult <ItemResponse <int> > Add(FaqAddRequest model)
        {
            ObjectResult result = null;

            try
            {
                int userId = _authService.GetCurrentUserId();
                int id     = _service.Add(model, userId);
                ItemResponse <int> response = new ItemResponse <int> {
                    Item = id
                };
                result = Created201(response);
            }
            catch (Exception exception)
            {
                base.Logger.LogError(exception.ToString());
                ErrorResponse response = new ErrorResponse(exception.Message);
                result = StatusCode(500, response);
            }

            return(result);
        }
示例#3
0
 public RedirectToRouteResult Add_POST(Faq item)
 {
     _faqService.Add(item);
     return(RedirectToAction("Edit", "Webpage", new { id = item.ShowFaqs.Id }));
 }
示例#4
0
        public IActionResult Post([FromBody] Faq body)
        {
            var entity = _manager.Add(body);

            return(ResponseJson(entity));
        }