public async Task <ActionResult <TemperatureViewModel> > Get(int cityId) { var temperatureDto = await _temperatureService.GetTemperatureByCityId(cityId); var temperatureViewModel = TemperaratureMappers.FromTemperatureDtoToTemperatureViewModel(temperatureDto); if (temperatureDto == null) { return(NotFound()); } return(temperatureViewModel); }
public async Task <TemperatureDto> GetTemperatureByCityId(int cityId) { var city = await _cityRepository.GetById(cityId); return(TemperaratureMappers.FromCityToTemperatureDto(city)); }