Beispiel #1
0
 public DatabaseCity(ApiWeatherObject weatherObject)
 {
     this.Id            = weatherObject.Id;
     this.Name          = weatherObject.Name;
     this.CountryIso    = weatherObject.Sys.Country;
     this.TimezoneShift = weatherObject.Timezone;
 }
        // API Current Weather.
        public DatabaseWeather(ApiWeatherObject weatherObject)
        {
            // Konvertiert den Unix Timestamp aus der API in DateTime
            this.TimeOfCalculation = DateTimeOffset.FromUnixTimeSeconds(weatherObject.Dt).DateTime;

            this.TimeOfWeather = Helper.RoundDateTimeToHours(this.TimeOfCalculation, 3);

            this.CityId      = weatherObject.Id;
            this.Temperature = weatherObject.Main.Temp;
            this.WindSpeed   = weatherObject.Wind.Speed;
            this.WindDegree  = weatherObject.Wind.Deg;
            this.Pressure    = weatherObject.Main.Pressure;
            this.Humidity    = weatherObject.Main.Humidity;
        }