Exemple #1
0
        public ActionResult Detail(string parkCode)
        {
            if (Session["isCelsius"] == null)
            {
                Session["isCelsius"] = false;
            }

            if (parkCode == "" || parkCode == null)
            {
                return(RedirectToAction("Index", "Home"));
            }
            else if (parkDAL.GetPark(parkCode) == null)
            {
                return(RedirectToAction("PageNotFound", "Home"));
                //return httpnotfound(); <--this will return the 404 page
                //This allows you to set the web config to direct them to a different URL (look at exception not found website)
            }

            Park model = parkDAL.GetPark(parkCode);

            model.Forecast = parkDAL.GetFiveDayForecast(parkCode);
            model.SwitchDegrees(Convert.ToBoolean(Session["isCelsius"]));

            return(View("Detail", model));
        }
        public ActionResult ParkDetail(string parkName)
        {
            Park park = parkDAL.GetParkDetail(parkName);

            if (park == null)
            {
                return(HttpNotFound());
            }

            if (Session["isFahrenheit"] == null)
            {
                Session["isFahrenheit"] = true;
            }

            park.FiveDayForecast = parkDAL.GetFiveDayForecast(park.ParkImage);

            park.IsFahrenheit = (bool)Session["isFahrenheit"];

            return(View("ParkDetail", park));
        }