public ActionResult Weather(string id) { IParkDAL DAL = new ParkSqlDAL(); List <Park> ParkList = DAL.getAllParksData(); List <Weather> weather = new List <Weather>(); foreach (Park p in ParkList) { if (id == p.ParkCode) { IWeatherDAL thisDAL = new WeatherSqlDAL(); weather = thisDAL.getWeatherByParkCode(p.ParkCode); } } bool isFaranheight; Session["Tempature"] = Request.Params["Tempature"]; if (Session["Tempature"] != null) { if (Session["Tempature"].ToString() == "F") { isFaranheight = true; } else { isFaranheight = false; } } else { isFaranheight = true; } // update to Faranheight or Celcius for (int i = 0; i < weather.Count; i++) { if (isFaranheight) { if (weather[i].Tempature == "F") { continue; } else { weather[i].Tempature = "F"; weather[i].High = ChangeFaranheightToCelcius(weather[i].High, "F"); weather[i].Low = ChangeFaranheightToCelcius(weather[i].Low, "F"); } } else { weather[i].Tempature = "C"; weather[i].High = ChangeFaranheightToCelcius(weather[i].High, "C"); weather[i].Low = ChangeFaranheightToCelcius(weather[i].Low, "C"); } } return(View("Weather", weather)); }
// GET: Home/Parklist public ActionResult ParkList() { Session["ParkList"] = "active"; IParkDAL DAL = new ParkSqlDAL(); List <Park> model = DAL.getAllParksData(); return(View("ParkList", model)); }
public void ParkSqlDAL_GetAllParks_Test() { //Arrange IParkDAL parkDAL = new ParkSqlDAL(); //Act List <Park> allParks = parkDAL.getAllParksData(); //Assert Assert.IsNotNull(parkDAL); Assert.IsNotNull(allParks); Assert.AreEqual(10, allParks.Count); }
public ActionResult ParkDetails(string id) { IParkDAL DAL = new ParkSqlDAL(); List <Park> ParkList = DAL.getAllParksData(); Park model = null; foreach (Park p in ParkList) { if (id == p.ParkCode) { model = p; } } return(View("ParkDetails", model)); }