public async Task <ActionResult <City> > UpdateCityAsync(int id, City city) { if (id != city.Id) { return(BadRequest()); } var updateReturn = await _cityRepository.Update(id, city); if (updateReturn != null) { return(Ok(city)); } return(BadRequest()); }
public async Task <ActionResult <User> > UpdateUserAsync(int id, User user) { try { if (id != user.Id) { return(BadRequest()); } var updateReturn = await _userRepository.Update(id, user); if (updateReturn != null) { return(Ok(user)); } return(BadRequest()); } catch (Exception e) { return(BadRequest(new { message = "Error to update user", exception = e.Message, innerExeption = e.InnerException?.Message })); } }