Esempio n. 1
0
 public ActionResult Index(WeatherInfoViewModel model)
 {
     if (ModelState.IsValid == false)
     {
         return View( new WeatherInfoViewModel
         {
             WeatherCode = model.WeatherCode,
             WeatherInfo = null
         });
     }
     var weatherBug = new WeatherBug.WeatherBug();
     var info = weatherBug.checkWeather(WeatherBug.WeatherTypeEnum.ZipCode, model.WeatherCode.ToString());
     var viewModel = new WeatherInfoViewModel
     {
         WeatherCode = model.WeatherCode,
         WeatherInfo = info
     };
     return View(viewModel);
 }
Esempio n. 2
0
        public ActionResult Index(WeatherInfoViewModel model)
        {
            if (ModelState.IsValid == false)
            {
                return(View(new WeatherInfoViewModel
                {
                    WeatherCode = model.WeatherCode,
                    WeatherInfo = null
                }));
            }
            var weatherBug = new WeatherBug.WeatherBug();
            var info       = weatherBug.checkWeather(WeatherBug.WeatherTypeEnum.ZipCode, model.WeatherCode.ToString());
            var viewModel  = new WeatherInfoViewModel
            {
                WeatherCode = model.WeatherCode,
                WeatherInfo = info
            };

            return(View(viewModel));
        }