Esempio n. 1
0
        public async Task <IEnumerable <WeatherForecast> > Handle(WeatherForecastQuery request, CancellationToken cancellationToken)
        {
            var rng       = new Random();
            var summaries = _service.GetSummaries();

            return(await Task.FromResult(Enumerable.Range(1, 5)
                                         .Select(index => new WeatherForecast
            {
                Date = DateTime.Now.AddDays(index),
                TemperatureC = rng.Next(-20, 55),
                Summary = summaries[rng.Next(summaries.Count())]
            })));
        }
Esempio n. 2
0
        public Task <WeatherForecast[]> HandleAsync(WeatherForecastQuery query)
        {
            var startDate = query.StartDate;

            var rng = new Random();

            return(Task.FromResult(Enumerable.Range(1, 5).Select(index => new WeatherForecast
            {
                Date = startDate.AddDays(index),
                TemperatureC = rng.Next(-20, 55),
                Summary = _summaries[rng.Next(_summaries.Length)]
            }).ToArray()));
        }
Esempio n. 3
0
 public WeatherForecastSchema(WeatherForecastQuery weatherForecastQuery)
 {
     Query = weatherForecastQuery;
 }