public ActionResult Index() { var reportModel = new ReportViewModel() { From = DateTime.Now.AddDays(-1).Date, To = DateTime.Now.Date }; if (!string.IsNullOrEmpty(Request.QueryString.Get("sort")) && Session["lastModel"] != null) { reportModel = (ReportViewModel)Session["lastModel"]; } return View(reportModel); }
public ActionResult Index(ReportViewModel model) { if (ModelState.IsValid) { ViewBag.Chart = _chartGenerator.GetChart(model.From, model.To); model.SolarCollectorValues = _dbReader.GetTemperatures(Sensor.SolarCollector, model.From, model.To); model.BoilerBottomValues = _dbReader.GetTemperatures(Sensor.BoilerBottom, model.From, model.To); Session["lastModel"] = model; } return View(model); }