Beispiel #1
0
        public ActionResult Detail(string parkCode, string tempType)
        {
            /*Wanted to have a default Park Code for if the user attempts to reach this page without
             * going through Park List*/
            if (parkCode == null)
            {
                parkCode = "ENP";
            }

            /*This sets the temp choice as a Session value in order to persist for future View calls*/
            if (tempType == null)
            {
                tempType = Session["tempChoice"] as string;
            }

            //Persistence of temperature choice demonstrated below
            Session["tempChoice"] = tempType;

            //Database call to receive 5-Day Forecast
            List <WeatherReport> weatherReports = _dal.GetWeatherReports(parkCode, tempType);
            NationalPark         park           = _dal.GetOnePark(parkCode);
            DetailModel          model          = new DetailModel
            {
                NationalPark   = park,
                WeatherReports = weatherReports
            };

            return(View("Detail", model));
        }
        public ActionResult Detail(string parkCode, string tempType)
        {
            if (parkCode == null)
            {
                parkCode = "ENP";
            }

            if (tempType == null)
            {
                tempType = Session["tempChoice"] as string;
            }

            Session["tempChoice"] = tempType;

            List <WeatherReport> weatherReports = _dal.GetWeatherReports(parkCode, tempType);
            NationalPark         park           = _dal.GetOnePark(parkCode);
            DetailModel          model          = new DetailModel
            {
                NationalPark   = park,
                WeatherReports = weatherReports
            };

            return(View("Detail", model));
        }