public async Task <ActionResult <City> > GetCity(int id) { var city = await _cityRepository.Get(id); if (city == null) { return(NotFound()); } return(Ok(city)); }
public async Task <ActionResult <User> > GetUser(int id) { try { var user = await _userRepository.Get(id); if (user == null) { return(NotFound()); } return(Ok(user)); } catch (Exception e) { return(BadRequest(new { message = "Error to find user", exception = e.Message, innerExeption = e.InnerException?.Message })); } }