public ActionResult Detail(int id = 0) { ViewBag.Title = "View Report"; ViewBag.Message = "Modify this template to jump-start your ASP.NET MVC application."; ReportingModel model = new ReportingModel(); // Find the correct report entity Report report = db.Reports.Find(id); if (report == null) { return HttpNotFound(); } // Query Reports in traditional SQL... safely SqlHelper.SqlTable sqlTable = SqlHelper.getTableFromRawSql(report.Query); model.table = sqlTable.contents; model.error = String.Join<string>("\n", sqlTable.errorStrings); return View(model); }
public ActionResult Index() { ViewBag.Title = "Reports List"; ViewBag.Message = "Modify this template to jump-start your ASP.NET MVC application."; ReportingModel model = new ReportingModel(); List<Report> reportsList = db.Reports.ToList(); foreach (Report r in reportsList) { model.idList.Add(r.ReportID); } model.table = DataTableHelper.listToTable<Report>(reportsList, Report.getDefaultColumns); return View(model); }