Ejemplo n.º 1
0
 private City ToWeatherCity(AccuWeatherLocationDTO location)
 {
     return(new City()
     {
         Name = location.EnglishName,
         Latitude = location.GeoPosition.Latitude,
         Longitude = location.GeoPosition.Longitude
     });
 }
Ejemplo n.º 2
0
        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
            });
        }
Ejemplo n.º 3
0
        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
            });
        }