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);
        }
示例#2
0
        public async Task <TemperatureDto> GetTemperatureByCityId(int cityId)
        {
            var city = await _cityRepository.GetById(cityId);

            return(TemperaratureMappers.FromCityToTemperatureDto(city));
        }