public ActionResult AddWeatherInfo(WeatherInfo weatherInfo, string day) { try{ if (ModelState.IsValid) { var _weatherInfo = maintainer.SearchByDay((string)day); if (_weatherInfo != null) { throw new Exception("The day already exist, please choose another day!"); } else { weatherInfo.LastMaintainerId = User.Identity.Name; maintainer.AddWeatherInfo(weatherInfo); } } return(RedirectToAction("Index")); } catch (Exception e) { return(View("Error", new HandleErrorInfo(e, "Maintainer", "AddWeatherInfo"))); } }