Beispiel #1
0
        //Previous city forecast
        public ViewResult PreviousCity(string city)
        {
            Index model = new Models.Index();

            model.ResCityName = city;
            model.last        = true;
            WeatherForecastService forecast = new WeatherForecastService();
            var weather = forecast.GetWeather(model);

            ViewGen(weather.OWMForecast, weather.WUForecast);
            var cookieService = new CookieService();

            cookieService.CookieAddCity(model, model.ResCityName, this);
            ViewBag.space = " ";
            return(View("ShowWeather", model));
        }
Beispiel #2
0
 public ViewResult Index(Index model)
 {
     if (ModelState.IsValid)
     {
         var forecast = new WeatherForecastService();
         var weather  = forecast.GetWeather(model);
         ViewGen(weather.OWMForecast, weather.WUForecast);
         var cookieService = new CookieService();
         cookieService.CookieAddCity(model, model.ResCityName, this);
         ViewBag.space = " ";
         return(View("ShowWeather", model));
     }
     else
     {
         return(View("ShowWeather", model));
     }
 }