public IActionResult Put(int id, [FromBody] CatUpdateModel value) { if (value == null) { return(BadRequest()); } _catService.EditCat(id, value); return(NoContent()); }
public IActionResult Put(int id, [FromBody] CatUpdateModel value) { var result = _catService.GetCat(id); if (result == null) { return(NotFound()); } if (!ModelState.IsValid) { return(new UnprocessableEntityObjectResult(ModelState)); } _catService.EditCat(id, value); return(Ok(value)); }
public async Task <ActionResult> Put(int id, [FromBody] CatUpdateModel value) { var result = await _catService.GetCat(id); if (result == null) { return(NotFound()); } if (!ModelState.IsValid) { return(new UnprocessableEntityObjectResult(ModelState)); } await _catService.EditCat(id, value); _logger.LogInformation("Update:{id}|{@value}", id, value); return(Ok(value)); }