private void GetChildRights(int parentId, List <SysPermission> list) { foreach (SysPermission allRight in AllPermissions.Where(p => p.ParentId == parentId)) { list.Add(allRight); GetChildRights(allRight.PermissionId, list); } }
/// <summary> /// Get permission from the list by its permission name. /// </summary> /// <param name="permissionName"></param> /// <returns></returns> public static ApplicationPermission GetPermissionByName(string permissionName) { return(AllPermissions.Where(p => p.Name == permissionName).FirstOrDefault()); }