private static Common.Weather.WeatherPoint ConvertToWeatherPoint(WeatherPoint source) { var destination = new Common.Weather.WeatherPoint() { SunAltitude = source.SunAltitude, Timestamp = source.Timestamp.ToLocalTime(), Location = new Common.Weather.Location() }; ConvertWeatherLocation(destination.Location, source); if (source.Weather != null) { destination.Weather = new Common.Weather.WeatherPointData(); ConvertWeather(destination.Weather, source.Weather); } return destination; }
private static void ConvertWeatherLocation(Common.Weather.Location destination, WeatherPoint source) { if (source.Location != null) { destination.Country = source.Location.Country; destination.Locality = source.Location.Locality; } if (source.Geo != null && source.Geo.Coordinates != null && source.Geo.Coordinates.Count == 2) { destination.Latitude = source.Geo.Coordinates[0]; destination.Longitude = source.Geo.Coordinates[1]; } }