/// <summary> /// Takes in the park id to find a park by the id from the database to display a detail page /// </summary> /// <param name="id">The park id to search for</param> /// <returns></returns> public ActionResult Detail(string id) { //Sets the initial Session["isFahrenheit"] variable if this is the first time visiting the page if (Session["isFahrenheit"] == null) { Session["isFahrenheit"] = true; } //gets all the details needed for the Park Detail page var park = _parkDAL.GetParkById(id); TempData["id"] = id.ToString(); park.FiveDayForecast = _weatherDAL.GetFiveDayForecast(id); return(View("Detail", park)); }
// GET: Home/Detail public ActionResult Detail(string parkCode, string scale) { if (scale == null) { scale = "true"; } else { Session["temp"] = scale; Session["button"] = scale; } ParkDetailViewModel model = new ParkDetailViewModel(); List <Weather> forecast = _weatherDAL.GetFiveDayForecast(parkCode); Park park = _parkdal.GetParkByCode(parkCode); model.PopulateParkProperties(park); model.PopulateForecast(forecast); model.IsFahrenheit = Convert.ToBoolean(Session["temp"]); return(View("Detail", model)); }