public Task <HttpResponseMessage> Put(int id, [FromBody] dynamic body)
        {
            var command = new UpdateCategoryCommand(
                id: id,
                title: (string)body.title
                );

            var category = _service.Update(command);

            return(CreateResponse(HttpStatusCode.OK, category));
        }
Example #2
0
 public ActionResult <CategoryDTO> Put(int id, [FromBody] CategoryDTO category)
 {
     try
     {
         return(Ok(_categoryApplicationService.Update(id, category)));
     }
     catch (Exception ex)
     {
         return(BadRequest(new { message = ex.GetExceptionMessage() }));
     }
 }
Example #3
0
        public IActionResult Edit(CategoryViewModel categoryViewModel)
        {
            if (categoryViewModel.Id == 0)
            {
                return(NotFound());
            }

            if (!ModelState.IsValid)
            {
                return(View(categoryViewModel));
            }
            _applicationService.Update(categoryViewModel);
            TempData["ServerResult"] = IsValidOperation() ? "success;Category updated successfully!" : "error;Category was not updated. See the notifications for details.";
            return(View(categoryViewModel));
        }
        public async Task <IActionResult> Update([FromBody] CategoryModelRequest request)
        {
            ResultResponse result = await _categoryApplicationService.Update(request);

            return(Response(result));
        }