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())] }))); }
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())); }
public WeatherForecastSchema(WeatherForecastQuery weatherForecastQuery) { Query = weatherForecastQuery; }