private City ToWeatherCity(AccuWeatherLocationDTO location) { return(new City() { Name = location.EnglishName, Latitude = location.GeoPosition.Latitude, Longitude = location.GeoPosition.Longitude }); }
public WeatherData ToDomainEntity(AccuweatherDTO input, AccuWeatherLocationDTO location, bool isImperial) { var weather = new Weather() { Humidity = input.RelativeHumidity, Pressure = isImperial ? input.Pressure.Imperial.Value : input.Pressure.Metric.Value, TemperatureCurrent = Math.Round(isImperial ? input.Temperature.Imperial.Value : input.Temperature.Metric.Value), WindSpeed = isImperial ? input.Wind.Speed.Imperial.Value : input.Wind.Speed.Metric.Value, WeatherDescription = input.WeatherText, Icon = $"accuweather{input.WeatherIcon}.png" }; var city = ToWeatherCity(location); return(new WeatherData { City = city, Weather = weather }); }
public WeatherForecast ToDomainEntities(AccuweatherForecastDTO accuweatherForecastDTO, AccuWeatherLocationDTO location) { List <Weather> weatherList = new List <Weather>(); foreach (var forecastWeather in accuweatherForecastDTO.DailyForecasts) { weatherList.Add(ConvertForecastModel(forecastWeather)); } var city = ToWeatherCity(location); return(new WeatherForecast { City = city, WeatherList = weatherList }); }