public ParkDetailViewModel GetParkDetailViewModelFromParkID(string id) { ParkDetailViewModel model = new ParkDetailViewModel(); Park park = parkSqlDAL.GetPark(id); List <DailyWeather> dailyWeather = weatherSqlDAL.GetWeatherForecast(id); model.Park = park; model.DailyWeather = dailyWeather; int?sessionInFahrenheit = HttpContext.Session.GetInt32("InFahrenheit"); if (sessionInFahrenheit == null) { HttpContext.Session.SetInt32("InFahrenheit", 1); sessionInFahrenheit = 1; } if (sessionInFahrenheit == 0) { model.InFahrenheit = false; } else { model.InFahrenheit = true; } return(model); }
public IActionResult Detail(string parkCode) { // get the park by its unique code // within the park, get all of its weather // find out what the user preferences are var park = dal.GetPark(parkCode); var weather = weatherDal.GetAllWeather(parkCode); string pref = HttpContext.Session.GetString("pref"); if (pref == null) { pref = "F"; HttpContext.Session.SetString("pref", pref); } // need to check if it's Fahrenheit so that we can toggle between types else if (pref == "fahrenheit") { pref = "F"; } else { pref = "C"; } var model = new ParkWeatherModel(park, weather); model.TempPref = pref; // pass our ViewModel back into our View return(View(model)); }
public IActionResult Details(string data) { DetailsViewModel model = new DetailsViewModel(); model.Park = parkDAL.GetPark(data); model.FiveDayWeather = weatherDAL.GetWeatherForPark(data); model.TemperatureSetting = GetCurrentTemperatureSetting(); return(View(model)); }
public void GetParkTests() { //Arrange Park park = new Park(); //Act park = parkSqlDAL.GetPark("TEST"); //Assert Assert.AreEqual("TEST", park.ParkCode); }