Example #1
0
        public IActionResult Detail(string code)
        {
            // Get the chosen Park
            Park park = ParksDAL.GetPark(code);

            ////Get the forecast for the park
            //park.FiveDayForecast = WeatherDAL.GetForecast(code);
            //// If the user has a unit preference for temp unit, apply it to each weather element
            //if (HttpContext.Session.Get<string>(Temp_Unit_Choice) != null)
            //{
            //	park.FiveDayForecast.Select(w => { w.UnitPrefence = HttpContext.Session.Get<string>(Temp_Unit_Choice); return w; }).ToList();
            //}

            TempData["unit"] = HttpContext.Session.Get <string>(Temp_Unit_Choice);

            // Only display the page, if the park was found
            if (park.Code == code)
            {
                return(View(park));
            }
            else
            {
                return(RedirectToAction("Error"));
            }
        }
        public ActionResult ForecastResult(string parkCode, string TemperatureUnit)
        {
            Session[Session_ParkName]        = parkDAL.GetPark(parkCode).ParkName;
            Session[Session_ParkCode]        = parkCode;
            Session[Session_TemperatureUnit] = TemperatureUnit;

            return(RedirectToAction("Forecast"));
        }
        //GET: Detail Page
        public ActionResult Detail(string parkCode)
        {
            if (parkCode == null)
            {
                parkCode = "CVNP";
            }
            Park park = _dal.GetPark(parkCode);

            park.Forecast   = _weatherdal.GetWeather(parkCode);
            park.TempHelper = GetActiveTempHelper();
            return(View("Detail", park));
        }
Example #4
0
        public IActionResult ParkDetails(string parkCode)
        {
            var park = _parksDAL.GetPark(parkCode);

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

            park.Forecasts = _parksDAL.GetWeatherForecasts(park);

            return(park.Forecasts == null?Error() : View(park));
        }
Example #5
0
        public ActionResult Detail(string parkCode, string parkName)
        {
            Session[Session_ParkCode] = parkCode;
            Session[Session_ParkName] = parkName;
            ParkModel park = parksDAL.GetPark(parkCode);

            if (park != null)
            {
                return(View("Detail", park));
            }
            else
            {
                return(new HttpNotFoundResult());
            }
        }
Example #6
0
        /// <summary>
        /// Passes in string for Park Code, creates a DetailViewModel object,
        /// sets the Park property, sets the FiveDayForecast property, checks
        /// if SessionData is null, assigns a char value if not, then passes
        /// the DetailViewModel object to the Detail View and returns the View
        /// </summary>
        /// <param name="id">Park Code</param>
        /// <returns>Detail View, DetailViewModel object</returns>
        // GET: Detail
        public ActionResult Detail(string id)
        {
            DetailViewModel detail = new DetailViewModel();

            detail.Park            = _dal.GetPark(id);
            detail.FivedayForecast = _dal.GetFiveDayForecast(id);

            if (Session[_tempConvertKey] != null)
            {
                if ((char)Session[_tempConvertKey] == 'C')
                {
                    detail.isCelcius = true;
                }
                else if ((char)Session[_tempConvertKey] == 'F')
                {
                    detail.isCelcius = false;
                }
            }

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