public WeatherData ToDomainEntity(WeatherbitDTO weatherbitDTO) { var input = weatherbitDTO.data[0]; Weather weather = ToWeather(input); var city = ToWeatherCity(input); return(new WeatherData { City = city, Weather = weather }); }
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 WeatherData ToDomainEntity(AmbeeDTO ambeeDTO, string cityName, bool isImperial) { var input = ambeeDTO.data; var weather = new Weather() { Humidity = input.humidity, Pressure = input.pressure, TemperatureCurrent = isImperial ? Math.Round(input.temperature) : Math.Round(FahrenheitToCelsius(input.temperature)), WindSpeed = input.windSpeed, WeatherDescription = "", Icon = $"" }; var city = ToWeatherCity(ambeeDTO.data.lat, ambeeDTO.data.lng, cityName); return(new WeatherData { City = city, Weather = weather }); }
private Weather ToWeather(WeatherbitData input) { DateTime date = DateTime.MinValue; DateTime.TryParse(input.datetime, out date); var weather = new Weather() { Pressure = input.pres, TemperatureCurrent = Math.Round(input.temp), TemperatureMax = Math.Round(input.max_temp), TemperatureMin = Math.Round(input.min_temp), WindSpeed = input.wind_spd, WeatherDescription = input.weather.description, Icon = $"{input.weather.icon}.png", Date = date }; return(weather); }
public WeatherData ToDomainEntity(DarkskyDTO darkskyDTO, string cityName) { var input = darkskyDTO.currently; var weather = new Weather() { Humidity = input.humidity, Pressure = input.pressure, TemperatureCurrent = Math.Round(input.temperature), WindSpeed = input.windSpeed, WeatherDescription = input.summary, Icon = $"{input.icon.Replace('-', '_')}.png" }; var city = ToWeatherCity(darkskyDTO, cityName); return(new WeatherData { City = city, Weather = weather }); }
public WeatherData ToDomainEntity(OpenWeatherMapDTO openWeatherMapDTO, string cityName) { var input = openWeatherMapDTO.current; var weather = new Weather() { Humidity = input.humidity, Pressure = input.pressure, TemperatureCurrent = Math.Round(input.temp), WindSpeed = input.wind_speed, WeatherDescription = input.weather[0].description, Icon = $"openweathermap{input.weather[0].icon}.png" }; var city = new City { Name = cityName, Latitude = openWeatherMapDTO.lat, Longitude = openWeatherMapDTO.lon }; return(new WeatherData { City = city, Weather = weather }); }