using System.Collections.Generic; using System.Web.Mvc; using Neo.Legitimate.OperatingLicences.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.OperatingLicences.Controllers { public partial class OperatingLicencesController : Neo.Legitimate.Common.ControllerBase { #region Action Results #region Reports public ActionResult Reports() { if (!SecurityHelper.UserHasAccessToSecurable(Profile.Securables.ToList(), Common.Securable.OperatingLicencesModule_Reports)) { return RedirectToAction("Default", "Applications"); } var reportDatabase = new ReportDatabase(); var userSecurables = Profile.Securables.ToList(); var definitions = reportDatabase.GetReportDefinitions((int)Common.ReportGroups.OLReports).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, "OperatingLicences/Reports"); ViewBag.Controller = "Operating Licences"; ViewBag.Page = "Reports"; return View("Reports", model); } #endregion #endregion #region JSON endpoints #endregion } }