Esempio n. 1
0
        public ActionResult Main()
        {
            var model = new MainViewModel
            {
                MainItems =
                    new List<MainItemViewModel>
                    {
                        new MainItemViewModel{ CityName="Burbank", CurrentTemperature=60, },
                        new MainItemViewModel {CityName="Granada Hills", CurrentTemperature=64, },
                        new MainItemViewModel {CityName="Los Angeles", CurrentTemperature=58, },
                    },
                UnitType = "F",
            };

            return View(model);
        }
Esempio n. 2
0
        public MainViewModel GetCurrentWeatherByLocation(decimal latitude, decimal longitude)
        {

            var location = new Location.Location(Settings);
            var currentWeather = location.GetCurrentWeatherByLocation(latitude, longitude);

            var model = new MainViewModel
            {
                MainItems =
                    new List<MainItemViewModel>
                    {
                        new MainItemViewModel{ CityName="Glendale, CA, USA", CurrentTemperature= decimal.Round(currentWeather.Temperature, 1), },
                    },
                UnitType = currentWeather.UnitType.ToString("g").Substring(0, 1).ToUpper(),
            };

            return model;
        }