Beispiel #1
0
 internal static HourlyForecastViewModel GetCurrentWeather(WeatherModel model)
 {
     var currentWeather = model.HourlyForecast.FirstOrDefault();
     if (currentWeather == null)
     {
         return null;
     }
     var hourlyForecast = new HourlyForecastViewModel()
     {
         Conditions = currentWeather.Conditions,
         Time = Int32.Parse(currentWeather.Time.ToString("hh")),
         Temperature = currentWeather.Temperature.Value,
         Rainfall = currentWeather.Rainfall.Value,
         Snowfall = currentWeather.Snowfall.Value,
     };
     return hourlyForecast;
 }
Beispiel #2
0
        internal static HourlyForecastViewModel GetCurrentWeather(WeatherModel model)
        {
            var currentWeather = model.HourlyForecast.FirstOrDefault();

            if (currentWeather == null)
            {
                return(null);
            }
            var hourlyForecast = new HourlyForecastViewModel()
            {
                Conditions  = currentWeather.Conditions,
                Time        = Int32.Parse(currentWeather.Time.ToString("hh")),
                AmPm        = currentWeather.Time.ToString("tt").ToLower(),
                Temperature = currentWeather.Temperature.Value,
                Rainfall    = currentWeather.Rainfall.Value,
                Snowfall    = currentWeather.Snowfall.Value,
            };

            return(hourlyForecast);
        }