コード例 #1
0
        // GET: SystemRoles
        public ActionResult Index()
        {
            ViewData["RolesPage"]    = "active";
            ViewData["PageTopTitle"] = "System Roles";

            var modules = moduleService.GetAllModules();
            var roles   = rolesService.GetSystemRoles();

            Dictionary <SystemRole, Dictionary <SystemModule, List <RolesModulesMapping> > > mappings
                = new Dictionary <SystemRole, Dictionary <SystemModule, List <RolesModulesMapping> > >();

            foreach (var role in roles)
            {
                Dictionary <SystemModule, List <RolesModulesMapping> > mod = new Dictionary <SystemModule, List <RolesModulesMapping> >();
                foreach (var module in modules)
                {
                    IEnumerable <RolesModulesMapping> mappingsList =
                        rolesService
                        .GetViewsModulesMappingByModuleIdAndRoleId(module.ModuleId, role.RoleId);

                    if (mappingsList != null)
                    {
                        if (mappingsList.Any())
                        {
                            mod.Add(module, mappingsList.ToList());
                        }
                    }
                }
                mappings.Add(role, mod);
            }

            return(View(mappings));
        }
コード例 #2
0
        public IHttpActionResult GetRoleModulesMappingsList(int roleId)
        {
            try
            {
                var modules = moduleService.GetAllModules();
                List <RolesModulesMappingAPI> mappings = new List <RolesModulesMappingAPI>();

                foreach (var module in modules)
                {
                    var res = rolesService.GetViewsModulesMappingByModuleIdAndRoleId(module.ModuleId, roleId).ToList();
                    if (res.Any())
                    {
                        mappings.Add(new RolesModulesMappingAPI()
                        {
                            RoleId     = roleId,
                            ModuleId   = module.ModuleId,
                            ModuleName = module.ModuleName,
                            Mappings   = res
                        }
                                     );
                    }
                }

                return(Ok(mappings));
            }
            catch (Exception ex)
            {
                return(InternalServerError(ex));
            }
        }
コード例 #3
0
        // GET: Home
        public ActionResult Index()
        {
            ViewData["dashboardPage"] = "active";
            ViewData["PageTopTitle"]  = "Dashboard";
            var modules = _service.GetAllModules();

            return(View(modules));
        }
コード例 #4
0
        // GET: SystemModules
        public ActionResult Index()
        {
            ViewData["modulesPage"]  = "active";
            ViewData["PageTopTitle"] = "System Modules";
            var modules = _modulesService.GetAllModules();

            return(View(modules));
        }
コード例 #5
0
 public IHttpActionResult GetModules(int pageNumber)
 {
     try
     {
         var modules = modulesService.GetAllModules()
                       .Select(m => new SystemModule()
         {
             IsActive    = m.IsActive,
             ModuleId    = m.ModuleId,
             CreatedDate = m.CreatedDate,
             ModuleName  = m.ModuleName
         });
         return(Ok(modules));
     }
     catch (Exception ex)
     {
         return(InternalServerError(ex));
     }
 }
コード例 #6
0
 public IHttpActionResult GetSystemModules()
 {
     try
     {
         return(Ok(modulesService.GetAllModules()));
     }
     catch (Exception ex)
     {
         return(InternalServerError(ex));
     }
 }