public HourlyValuesDomainModel MapToHourlyValuesDomainModel(OpenWeatherOneCallApiDataModel model) { HourlyValuesDomainModel domainModel = new HourlyValuesDomainModel(); domainModel.HourlyValues = new List <HourlyDomainModel>(); foreach (var hourly in model.Hourly) { domainModel.HourlyValues.Add(MapToHourlyValueDomainModel(hourly)); } return(domainModel); }
public List <string> GetHourlyWeatherForecast(int zipcode, ITemperatureStrategy temperatureStrategy, DateTime date) { List <string> result = new List <string>(); var hourlyData = Task.Run(() => _weatherForecastProvider.GetHourlyWeather(zipcode)); hourlyData.Wait(); HourlyValuesDomainModel model = hourlyData.Result; foreach (var hour in model.HourlyValues) { TemperatureInfo temperatureInfo = temperatureStrategy.GetTemperatureFromKelvin(hour.Temperature); double roundedTemperature = Math.Round(temperatureInfo.Temperature); result.Add($"In {zipcode} hat es am {hour.Time.ToString("dd/MM/yyyy, HH:mm")} Uhr {roundedTemperature} {temperatureInfo.Display} und es ist {hour.WeatherDescription}"); } return(result); }