public async Task <IEnumerable <WeatherObservationDto> > Get() { var observations = await _weatherRepository.GetAll(); return(observations.Select(o => new WeatherObservationDto { Date = o.Date, TemperatureC = o.TemperatureC, TemperatureF = o.TemperatureF, Summary = o.Summary })); }
protected override async Task ExecuteAsync(CancellationToken stoppingToken) { while (!stoppingToken.IsCancellationRequested) { _logger.LogInformation($"Worker running at {DateTime.Now}"); foreach (var weather in await _weatherRepository.GetAll()) { _logger.LogInformation($"removing {weather.Id}"); await _weatherRepository.Delete(weather.Id); await Task.Delay(TimeSpan.FromSeconds(2), stoppingToken); } await Task.Delay(TimeSpan.FromSeconds(30), stoppingToken); } }
public IEnumerable <WeatherForecast> GetAll() { return(weatherRepository.GetAll()); }
public async Task <GetAllResponse> Handle(GetAllRequest request, CancellationToken cancellationToken) { var currentsWeather = await _repository.GetAll(); return(_mapper.Map <GetAllResponse>(currentsWeather.Select(_mapper.Map <GetResponse>))); }
public PaginatingResultDto <WeatherForecast> GetAll( [FromQuery] int skipCount = 0, [FromQuery] int?maxResultCount = 10) { return(repository.GetAll(skipCount, maxResultCount)); }