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 Index() { int yosemiteId = 1; Park model = parkDAL.GetPark(yosemiteId); model.Campgrounds = campgroundDAL.GetCampgroundsForPark(yosemiteId); return(View("Index", model)); }
public ActionResult Detail(string parkCode) { DetailViewModel p = new DetailViewModel() { Park = parkDAL.GetPark(parkCode), FiveDaysOfWeather = weatherDAL.GetForecast(parkCode), IsFahrenheit = true }; return(View("Detail", p)); }
public ActionResult ParkDetail(string id) { List <ForecastModel> forecast = forcastDal.GetForecast(id); ParkModel park = parkDal.GetPark(id); WeatherViewModel weather = new WeatherViewModel() { Park = park, Forecast = forecast }; return(View("ParkDetail", weather)); }
public ActionResult Detail(string parkCode) { string tempScale = GetTempScale(); Park park = parkDal.GetPark(parkCode); if (park == null) { return(HttpNotFound()); } park.TempScale = tempScale; return(View("Detail", park)); }
public IActionResult Detail(string parkCode) { Park park = parkDal.GetPark(parkCode); IList <Weather> weather = weatherDal.GetWeatherByPark(parkCode); //send in a temperature scale? //get tempScale (default or via SetTempScale) //I feel like I'm not actually using the session b/c I'm saving it as a value in the model. string tempScale = HttpContext.Session.GetString("tempScale"); //if not set yet if (tempScale == null) { tempScale = "F"; HttpContext.Session.SetString("tempScale", tempScale); //this defaults the weather to Fahrenheit scale (could base on location?) } //if set to fahrenheit **FROM** celcius else if (tempScale == "tempF") { tempScale = "F"; //set tempscale to F (for detail page weather report) if fahrenheit is chosen by button } //if set to celcius from fahrenheit else { tempScale = "C"; //set tempscale to C (for detail page weather report) if fahrenheit is chosen by button } DetailViewModel dvm = new DetailViewModel(park, weather); dvm.TempScale = tempScale; //load the detailViewModel with our tempscale. return(View(dvm)); }
public IActionResult Detail(string parkCode) { var park = dal.GetPark(parkCode); park.Forecast = wdal.FiveDayForecast(parkCode); string pref = HttpContext.Session.GetString(Session_Key); switch (pref) { case null: pref = "f"; HttpContext.Session.SetString(Session_Key, pref); break; case "c": HttpContext.Session.SetString(Session_Key, pref); break; case "f": HttpContext.Session.SetString(Session_Key, pref); break; default: break; } park.UserPreference = pref; return(View(park)); }
public IActionResult Detail(string id) { var park = parkDAL.GetPark(id); ViewBag.Forecast = forecastDAL.GetForecastForPark(id); return(View(park)); }
public void whenGetParkIsRunCodeIsCVNP() { Park park = new Park(); park = _parkDAL.GetPark("CVNP"); Assert.AreEqual("CVNP", park.Code); }
// GET: Park public ActionResult Detail(string id) { Park p = dal.GetPark(id); List <Weather> w = dal.GetWeather(id); PW pw = new PW(p, w); return(View("Detail", pw)); }
public ActionResult Detail(string id) { { ParkModel park = dal.GetPark(id); park.Weather = dal.GetWeather(id); return(View("Detail", park)); } }
public async Task <IActionResult> ParkDetail(string code) { ParkModel park = parkDAL.GetPark(code); ViewData["weathers"] = await parkDAL.GinerateWeathers(code); ViewData["settings"] = GetUserSettings(); return(View(park)); }
public ActionResult ParkDetail(string id) { ParksModel model = dal.GetPark(id); if (model == null) { return(HttpNotFound()); } return(View("ParkDetail", model)); }
public ActionResult ParkDetail(string parkCode) { if (parkCode.Equals(null)) { return(Index()); } var park = _dal.GetPark(parkCode); return(View("ParkDetail", park)); }
//Get: Deatil Page <--one park by the park code/id public ActionResult Detail(string parkID) { Park p = new Park(); Park ps = new Park(); p = dal.GetPark(parkID); p.weather = dal.Weather(parkID); p.IsFahrenheit = true; return(View("Detail", p)); }
public IActionResult Detail(string id) { var park = pdal.GetPark(id); //Get weather results for said park var weather = wdal.GetWeatherForPark(id); var model = new ParkDetailModel() { Park = park, ParkWeather = weather }; return(View(model)); }
public IActionResult Detail(string id) { ParkModel model = _parkDAL.GetPark(id); model.Weather = _weatherDAL.GetWeatherByPark(id); model.TemperatureScaleModel = new TemperatureScaleModel(); if (HttpContext.Session.Get <TemperatureScaleModel>("TemperatureType") != null) { model.TemperatureScaleModel.TemperatureScale = HttpContext.Session.Get <TemperatureScaleModel>("TemperatureType").TemperatureScale.ToString(); } return(View(model)); }
public IActionResult Index() { Dictionary <string, int> surveyCount = surveyDAL.GetSurveyPosts(); IList <SurveyPark> surveyParks = new List <SurveyPark>(); foreach (KeyValuePair <string, int> kvp in surveyCount) { var parkCount = parkDAL.GetPark(kvp.Key); SurveyPark surveyList = new SurveyPark(); surveyList.surveyPark = parkCount; surveyList.Count = kvp.Value; surveyParks.Add(surveyList); } return(View(surveyParks)); }
public ActionResult View(string parkCode) { ParkModel park = parkDAL.GetPark(parkCode); if (park == null) { return(HttpNotFound()); } List <DailyWeatherModel> fiveDayForecast = weatherDAL.GetParkWeather(parkCode); ParkDailyWeatherViewModel parkWeather = new ParkDailyWeatherViewModel() { Park = park, FiveDayForecast = fiveDayForecast }; return(View("View", parkWeather)); }
public IActionResult Detail(string code) { DetailViewModel park = new DetailViewModel(); park.Park = _parkDAL.GetPark(code); park.Weather = _weatherDAL.GetWeather(code); park.ForecastRecommendation = _weatherDAL.CreateForecastRecommendation(park.Weather[0].Forecast); park.TemperatureRecommendation = _weatherDAL.CreateTemperatureRecommendation(park.Weather[0].LowTemp, park.Weather[0].HighTemp); if (HttpContext.Session.Get <string>("UnitOfTemp") == "celsius") { foreach (Weather weather in park.Weather) { weather.ConvertTemp(); } } return(View(park)); }
public IActionResult Detail(string id) { DetailView detailView = new DetailView(); var park = dal.GetPark(id); var degree = GetCurrentDegree(); detailView.Park = park; var currentWeather = weatherDal.GetForecast(id); if (degree == "C") { foreach (var weather in currentWeather) { weather.Degree = "C"; weather.High = weather.ConvertToCelsius(weather.High); weather.Low = weather.ConvertToCelsius(weather.Low); } } detailView.fiveDay = currentWeather; return(View(detailView)); }
public IActionResult Detail(string parkCode) { Park park = parkDAL.GetPark(parkCode); List <Weather> weather = new List <Weather>(); string TempKey = HttpContext.Session.GetString("SessionTemperatureKey"); if (TempKey == "Fahrenheit") { weather = weatherDAL.GetWeather(parkCode); } else { weather = weatherDAL.GetWeatherCelsius(parkCode); } Detail detailObject = new Detail(); detailObject.park = park; detailObject.weather = weather; return(View(detailObject)); }
/// <summary> /// Detail View of Parks with 5 Day weather forecast /// </summary> /// <param name="id">Park.ParkCode to GET that park upon Click()</param> /// <returns>Detail View</returns> public ActionResult Detail(string id) { // If no park was clicked then return to index page if (id == null) { return(RedirectToAction("Index", "Park")); } //Gets current Temp unit to work with in View string tempUnit = GetCurrentTempUnit(); //Get park by param: id Park park = _parkDAL.GetPark(id); List <Weather> weather = _weatherDAL.GetWeatherByParkCode(id); ParkWeather pw = new ParkWeather() { Park = park, Weather = weather, TempUnit = tempUnit }; return(View("Detail", pw)); }
public ActionResult Detail(string parkCode) { NationalParkModel model = parkDAL.GetPark(parkCode); return(View("Detail", model)); }
// GET: Park/Detail public ActionResult Detail(string id) { Park park = _parkDal.GetPark(id); return View("ParkDetails", park); }
public ActionResult Detail(string parkCode) { ParkModel model = dal.GetPark(parkCode); return(View("Detail", model)); }