public IActionResult Detail(string code) { if (!HttpContext.Session.Keys.Contains("temp")) { HttpContext.Session.SetString("temp", "f"); } TempData["temp"] = HttpContext.Session.GetString("temp"); Park park = parkDAO.GetParkByParkCode(code); List <Weather> fiveDay = weatherDAO.GetForecast(code); DetailViewModel vm = new DetailViewModel(); vm.FiveDay = fiveDay; vm.forecasts = new List <Forecast>(); if (HttpContext.Session.GetString("temp") == "f") { vm.isFahrenheit = true; } else { vm.isFahrenheit = false; } vm.Park = park; return(View(vm)); }
public IActionResult ParkDetail(string id, string scale) { if (scale == null) { scale = HttpContext.Session.GetString("scale"); if (scale == null) { scale = "f"; } } else { HttpContext.Session.SetString("scale", scale); } ViewData["scale"] = scale; Park park = parkDao.GetParkDetails(id); park.Weathers = weatherDao.GetForecast(id); return(View(park)); }
public List <Weather> GetForecast(string id) { List <Weather> list = dao.GetForecast(id); return(list); }
public void GetFiveDay(IWeatherDAO dao, string id) { this.dao = dao; this.Id = id; fiveDayForecast = dao.GetForecast(id); }