public ActionResult Index(string parkCode) { List <Weather> weathers = dal.GetWeatherByParkCode(parkCode); if (GetTempetureChoice() == "Celcius") { foreach (var weather in weathers) { weather.IsCelcius = true; } } return(PartialView("Index", weathers)); }
/// <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)); }