Пример #1
0
        public ActionResult Index(string lat, string lng)
        {
            List <Weather> weatherList = new List <Weather>();

            //if (CurrentCorrList != null)
            //{
            //    //string lat = "";
            //    //string lng = "";
            //    foreach (var item in CurrentCorrList)
            //    {
            //        lat = item[0];
            //        lng = item[1];
            //    }

            weatherGateway.DeleteWeatherDataFromDB();
            weatherGateway.GetWeatherAndUpdateDB();
            weatherList = weatherGateway.GetWeatherFromDB();

            currentForecast = weatherGateway.GetCurrentWeather(weatherList, getMyAreaGateway.GetMyAreaName(lat, lng));
            ViewBag.Weather = currentForecast;
            //}
            //else
            //{
            //    ViewBag.Weather = "Retriving weather in progress...";
            //}

            return(View());
        }
Пример #2
0
        internal GeneralController()
        {
            List <Weather> weatherList = new List <Weather>();

            if (HomeController.CurrentCorrList != null)
            {
                string lat = "";
                string lng = "";
                foreach (var item in HomeController.CurrentCorrList)
                {
                    lat = item[0];
                    lng = item[1];
                }

                weatherGateway.DeleteWeatherDataFromDB();
                weatherGateway.GetWeatherAndUpdateDB();
                weatherList = weatherGateway.GetWeatherFromDB();

                currentForecast = weatherGateway.GetCurrentWeather(weatherList, getMyAddressGateway.GetMyAreaName(lat, lng));
                ViewBag.Weather = currentForecast;
            }
            else
            {
                ViewBag.Weather = "Error retriving weather forecast. Please try again.";
            }
        }