Пример #1
0
        public HttpResponseMessage Put(FaqUpdateRequest model)
        {
            if (!ModelState.IsValid && model != null)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState));
            }
            _faqService.Update(model);
            SuccessResponse response = new SuccessResponse();

            return(Request.CreateResponse(HttpStatusCode.OK, model));
        }
Пример #2
0
        public async Task <IActionResult> Update(string id, [FromBody] FaqMeta faqMeta)
        {
            var result = await _faqService.Update(CurrentUser.TenantId, CurrentUser.Id,
                                                  CurrentUser.FullName, CurrentUser.Avatar, id, faqMeta.IsQuickUpdate, faqMeta);

            if (result.Code <= 0)
            {
                return(BadRequest(result));
            }
            return(Ok(result));
        }
Пример #3
0
 public ActionResult Edit(Faq @faq)
 {
     if (ModelState.IsValid)
     {
         faqService.Update(@faq);
         faqService.Commit();
         SuccessMessage(FormMessages.SaveSuccess);
         return(RedirectToAction("Index"));
     }
     return(View(@faq));
 }
 public HttpResponseMessage Update(FaqUpdateRequest model)
 {
     try
     {
         _faqService.Update(model);
         return(Request.CreateResponse(HttpStatusCode.OK, new SuccessResponse()));
     }
     catch (Exception ex)
     {
         _errorService.LogError(ex);
         return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex));
     }
 }
Пример #5
0
        public void FaqService_Update()
        {
            IFaqService service = this.GetService <IFaqService>();

            service.Update(new FaqUpdateRequest()
            {
                Id           = 15,
                Title        = "UnitTestName02_changed",
                Description  = "UnitTestValue02_changed",
                DisplayOrder = 1,
                CategoryId   = 1,
                ModifiedBy   = "UnitTestUser02_changed"
            });
        }
Пример #6
0
        public HttpResponseMessage Update(FAQUpdateRequest 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));
            }

            SucessResponse response = new SucessResponse();

            _faqService.Update(model);

            return(Request.CreateResponse(response));
        }
Пример #7
0
        public ActionResult <SuccessResponse> Update(FaqUpdateRequest model)
        {
            int          responseCode = 200;
            BaseResponse responseData = null;

            try
            {
                int userId = _authService.GetCurrentUserId();
                _service.Update(model, userId);
                responseData = new SuccessResponse();
            }
            catch (Exception exception)
            {
                responseCode = 500;
                responseData = new ErrorResponse(exception.Message);
                base.Logger.LogError(exception.ToString());
            }

            return(StatusCode(responseCode, responseData));
        }
Пример #8
0
        public ActionResult Edit(FaqModel model)
        {
            if (ModelState.IsValid)
            {
                Faq faq = _faqService.GetById(model.Id);
                if (faq != null)
                {
                    faq.UpdateModel(model);
                    UpdateResult result = _faqService.Update(faq);
                    if (result.State == 1)
                    {
                        ViewBag.Completed = true;
                    }
                    else
                    {
                        ViewBag.Completed = false;
                    }
                }
            }

            return(View(model));
        }
Пример #9
0
 public RedirectToRouteResult Edit_POST(Faq item)
 {
     _faqService.Update(item);
     return(RedirectToAction("Edit", "Webpage", new { id = item.ShowFaqs.Id }));
 }
Пример #10
0
        public IActionResult Put([FromBody] Faq body)
        {
            var entity = _manager.Update(body);

            return(ResponseJson(_manager.Update(entity)));
        }