public async Task <IActionResult> Update([FromRoute] int id, [FromBody] Salon salon) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != salon.Id) { ModelState.AddModelError(nameof(salon.Id), Translation.IdMismatch); return(BadRequest(ModelState)); } try { await salonRepository.Update(salon); await salonRepository.SaveChanges(); } catch (Exception ex) { if (!salonRepository.Exist(id)) { return(NotFound()); } log.LogError("[POST: PUT: api/Salon/{0}] {1}", id, ex.Message); return(StatusCode(StatusCodes.Status500InternalServerError, ex.Message)); } return(NoContent()); }