示例#1
0
 public RoleAuthenticationModel GetRole(string roleName)
 {
     RoleAuthenticationModel e = new RoleAuthenticationModel();
     aspnet_Roles role = DB.aspnet_Roles.Where(r => r.RoleName == roleName).FirstOrDefault();
     if(role != null)
     {
         List<int?> controllerActionIDList = role.MVCAuthorizations.Select(r => r.ControllerActionID).ToList();
         e.RoleName = role.RoleName;
         e.ControllerActionIDList = controllerActionIDList;
     }
     return e;
 }
        public RoleAuthenticationModel GetRole(string roleName)
        {
            RoleAuthenticationModel e    = new RoleAuthenticationModel();
            aspnet_Roles            role = DB.aspnet_Roles.Where(r => r.RoleName == roleName).FirstOrDefault();

            if (role != null)
            {
                List <int?> controllerActionIDList = role.MVCAuthorizations.Select(r => r.ControllerActionID).ToList();
                e.RoleName = role.RoleName;
                e.ControllerActionIDList = controllerActionIDList;
            }
            return(e);
        }