public ActionResult GetCityList(LocationWeatherUpdate CountryName) { if (!ModelState.IsValid) { return(View("Index")); } clist = _WeatherInterface.GetCityList(CountryName.Country); var Cities = new LocationWeatherUpdate() { Country = CountryName.Country, CityList = (IEnumerable <Cities>)clist }; Session["Country"] = CountryName.Country; Session["CityList"] = clist; ViewBag.Message = ""; return(View("Index", Cities)); }
public ActionResult GetWeatherUpdate(FormCollection SelectedCity) { ViewBag.Message = ""; if (SelectedCity["CityList"].ToString() == "") { var Cities = new LocationWeatherUpdate() { Country = Session["Country"].ToString(), CityList = (IEnumerable <Cities>)Session["CityList"] }; ViewBag.Message = "Select City fro weather update report!"; return(View("Index", Cities)); } List <string> WeatherUpdate = _WeatherInterface.GetWeatherUpdate(Session["Country"].ToString(), SelectedCity["CityList"].ToString()); Session["City"] = SelectedCity["CityList"].ToString(); var TheUpdate = new LocationWeatherUpdate() { Country = Session["Country"].ToString(), CityList = (IEnumerable <Cities>)Session["CityList"], Status = WeatherUpdate[0].ToString(), CompleteLocation = WeatherUpdate[1].ToString(), Time = WeatherUpdate[2].ToString(), Wind = WeatherUpdate[3].ToString(), Visibility = WeatherUpdate[4].ToString(), SkyConditions = WeatherUpdate[5].ToString(), Temperature = WeatherUpdate[6].ToString(), DewPoint = WeatherUpdate[7].ToString(), RelativeHumidity = WeatherUpdate[8].ToString(), Pressure = WeatherUpdate[9].ToString() }; return(View("Index", TheUpdate)); }