// GET: Home public ActionResult Index() { // check if we have a PODashboardSummary object in the Session if (Session["poDashboardData"] == null) { // we don't, so let's create a new object, populate it and throw it into the session variable string qryString = "SELECT * FROM [vwGrantInfoSummary] WHERE [Status] IN ('New', 'In Progress', 'Pending') ORDER BY GrantId DESC"; List <GrantInfoSummary> summaryData = _ctx.Database.SqlQuery <GrantInfoSummary> (qryString).ToList(); string qryStringTotals = "SELECT * from vwGrantTotalSummary"; GrantTotals totals = _ctx.Database.SqlQuery <GrantTotals> (qryStringTotals).ToList().FirstOrDefault(); PODashboardSummary po = new PODashboardSummary { GrantInfoSummary = summaryData, GrantTotals = totals }; Session["poDashboardData"] = po; return(View("Dashboard", po)); } else { // we have a PODashboardSummary object in the Session // so let's just get it and return the view with the data return(View("Dashboard", (PODashboardSummary)Session["poDashboardData"])); } }
// GET: GrantInfoSummaries public ActionResult Index() { string qryString = "SELECT * FROM [vwGrantInfoSummary] WHERE [Status] IN ('New', 'In Progress', 'Pending') ORDER BY GrantId DESC"; List <GrantInfoSummary> summaryData = db.Database.SqlQuery <GrantInfoSummary> (qryString).ToList(); string qryStringTotals = "SELECT * from vwGrantTotalSummary"; GrantTotals totals = db.Database.SqlQuery <GrantTotals> (qryStringTotals).ToList().FirstOrDefault(); PODashboardSummary po = new PODashboardSummary { GrantInfoSummary = summaryData, GrantTotals = totals }; return(View("Index", po)); }