コード例 #1
0
        public Task <Response <IEnumerable <WeatherForecast> > > Handle(GetAllWeatherForecastsQuery request, CancellationToken cancellationToken)
        {
            var result = _dbContext.WeatherForecasts;

            _logger.LogInformation("Found {numberOfResults} results.", result.Count);
            return(Task.FromResult(ResponseFactory.Ok(result.AsEnumerable())));
        }
コード例 #2
0
        public async Task <IEnumerable <WeatherForecast> > Get([FromQuery] GetAllWeatherForecastsQuery query)
        {
            await this._fileProcessingChannel.AddFileAsync(Guid.NewGuid().ToString());

            return(await this._mediator.Send(query)
                   .ConfigureAwait(false));
        }
コード例 #3
0
        public async Task <IEnumerable <WeatherForecast> > Get([FromQuery] GetAllWeatherForecastsQuery query)
        {
            var forecasts = await this._mediator.Send(query)
                            .ConfigureAwait(false);

            foreach (var weatherForecast in forecasts)
            {
                this._sendMessageService.SendMessage(weatherForecast);
            }
            this._sendMessageService.SendMessage(new WeatherForecastList {
                Entities = forecasts
            });

            return(forecasts);
        }
コード例 #4
0
 public Task <List <WeatherForecast> > Handle(GetAllWeatherForecastsQuery request, CancellationToken cancellationToken)
 {
     return(Task.FromResult(WeatherForecastDatabase.Instance));
 }