Пример #1
0
        public async Task <WeatherForecastDto> Handle(GetByCityNameQuery request, CancellationToken cancellationToken)
        {
            var forecast = await _weatherClient.GetCurrentWeatherByCityNameAsync(request.City);

            if (forecast == null)
            {
                //TODO: logging
                return(new());
            }

            var weatherForecastDto = _mapper.Map <WeatherForecastDto>(forecast);
            var gotWeatherForecast = _mapper.Map <IGotWeatherForecast>(weatherForecastDto);

            await _publishEndpoint.Publish(gotWeatherForecast);

            return(weatherForecastDto);
        }