public static List <RolePermission> GetPermissionRolesByRoleId(int idRole) { using (var configuration_context = new Configuration_Entities()) { return(configuration_context.RolePermission.Where(x => x.IdRole == idRole).ToList()); } }
public static Role GetById(int idRole) { using (var configuration_context = new Configuration_Entities()) { return(configuration_context.Role.Where(x => x.Id == idRole).FirstOrDefault()); } }
public static List <UserRole> GetUserRolesByUsername(string username) { using (var configuration_context = new Configuration_Entities()) { return(configuration_context.UserRole.Where(x => x.Username == username).ToList()); } }
public static List <MenuPermission> GetMenuPermissionByMenuId(int idMenu) { using (var configuration_context = new Configuration_Entities()) { return(configuration_context.MenuPermission.Where(x => x.IdMenu == idMenu).ToList()); } }
public static Menu GetById(int idMenu) { using (var configuration_context = new Configuration_Entities()) { return(configuration_context.Menu.Where(x => x.Id == idMenu).FirstOrDefault()); } }
public static List <SP_MenuGroup_Menu_GetAll_Result> GetAll() { using (var configuration_context = new Configuration_Entities()) { return(configuration_context.SP_MenuGroup_Menu_GetAll().ToList()); } }
public static List <Permission> GetUserPermissionList(string username) { List <Permission> rtn = new List <Permission>(); if (username != null) { using (var configuration_context = new Configuration_Entities()) { List <UserRole> userRoleList = GetUserRole(username); foreach (UserRole userRole in userRoleList) { List <RolePermission> userRolePermissionList = configuration_context.RolePermission.Where(x => x.IdRole == userRole.IdRole).ToList(); foreach (RolePermission userRolePermission in userRolePermissionList) { Permission permissionToAdd = configuration_context.Permission.Where(x => x.Id == userRolePermission.IdPermission).FirstOrDefault(); if (permissionToAdd != null) { rtn.Add(permissionToAdd); } } } } } return(rtn); }
public static Permission GetById(int idPermission) { using (var configuration_context = new Configuration_Entities()) { return(configuration_context.Permission.Where(x => x.Id == idPermission).FirstOrDefault()); } }