using System.Collections.Generic; using System.Web.Mvc; using Neo.Legitimate.Vehicles.Models; using Neo.Legitimate.Data.Models; using Pilotfish.Afx.Mvc; using Pilotfish.Afx.Services.Integration; using Pilotfish.Afx.Services.Reports; using Pilotfish.Afx.ViewModels; using System.Linq; using Neo.Legitimate.Common; using Neo.Legitimate.Common.Helpers; namespace Neo.Legitimate.Vehicles.Controllers { public partial class VehiclesController : Neo.Legitimate.Common.ControllerBase { #region Action Results #region Reports public ActionResult Reports() { if (!SecurityHelper.UserHasAccessToSecurable(Profile.Securables.ToList(), Common.Securable.VehiclesModule_Reports)) { return RedirectToAction("Default", "Applications"); } var reportDatabase = new ReportDatabase(); var userSecurables = Profile.Securables.ToList(); var definitions = reportDatabase.GetReportDefinitions((int)Common.ReportGroups.VehicleReports).Where(a => !a.SecurableID.HasValue || userSecurables.Any(b => b.SecurableID == a.SecurableID.Value)); var model = new ReportModel() { UserID = Profile.UserID, UserRoles = Profile.Roles, ReportDefinitions = definitions, Lookups = null }; WebHelper.SetLastPageVisited(HttpContext, "Vehicles/Reports"); ViewBag.Controller = "Vehicles"; ViewBag.Page = "Reports"; return View("Reports", model); } #endregion #endregion #region JSON endpoints #endregion } }