public async Task <bool> IsPermissionsMenu(Guid userId, Guid menuId) { return(await(from ur in Queryable() join urm in _userRoleJurisdictionService.Queryable() on ur.RoleID equals urm.RoleID where ur.UserID == userId && urm.MenuID == menuId select urm).AnyAsync()); }
public async Task <IEnumerable <Menu> > QueryMenuViewModel(Guid userID) { var result = await(from m in Queryable() join urj in _userRoleJurisdictionService.Queryable() on m.ID equals urj.MenuID join ur in _userRoleService.Queryable() on urj.RoleID equals ur.RoleID where ur.UserID.Equals(userID) select m).Distinct().ToListAsync(); return(result); }
public async Task <IActionResult> RoleMenus(Guid roleID) { try { var result = from n in _menuService.Queryable() select new { id = $"{n.ID}|{n.ApplicationID}", pId = $"{n.ParentID}|{n.ApplicationID}", name = $"<span style='font-size: 13px; '>{n.Name}</span>", @checked = _roleJurisdictionService.Queryable().Any(a => a.MenuID == n.ID && a.RoleID == roleID), Description = n.Description.IsNullOrEmpty() ? n.Name : n.Description, open = true }; var model = await result.ToListAsync(); return(Json(model)); } catch (Exception e) { _logger.Error(e, "角色菜单树Json错误"); } return(Json("")); }