public override async Task Handle(WeatherForecastUpdatedJob notification, CancellationToken cancellationToken) { var weatherForeacast = await _weatherForecastRepository.FindAsync(cancellationToken, notification.WeatherForecastId); weatherForeacast.UpdateDate(DateTime.Now); _weatherForecastRepository.UpdateAsync(weatherForeacast); await _weatherForecastRepository.SaveChangesAsync(cancellationToken); }
public override async Task Handle(WeatherForecastCreatedEvent notification, CancellationToken cancellationToken) { var weatherForeacast = await _weatherForecastRepository.FindAsync(cancellationToken, notification.WeatherForecastId); weatherForeacast.UpdateSummary(weatherForeacast.Summary.ToUpper( )); _weatherForecastRepository.UpdateAsync(weatherForeacast); await _weatherForecastRepository.SaveChangesAsync(cancellationToken); }
public override async Task Handle(WeatherForecastContinuedJob notification, CancellationToken cancellationToken) { var weatherForeacast = await _weatherForecastRepository.FindAsync(cancellationToken, notification.WeatherForecastId); var temperatureF = 32 + ( int )(weatherForeacast.TemperatureC / 0.5556); weatherForeacast.SetTemperatureF(temperatureF); _weatherForecastRepository.UpdateAsync(weatherForeacast); await _weatherForecastRepository.SaveChangesAsync(cancellationToken); }
public ValueTask <WeatherForecast> GetAsync(long id, CancellationToken cancellationToken) { return(_weatherForecastRepository.FindAsync(cancellationToken, id)); }