public IEnumerable <VMenu> GetMenuByUserRole() { var userRole = _roleServices.GetUserRoleByUserId(CurrentUser.Id).Select(t => t.Role).Distinct(); var menuRole = _roleServices.GetMenuRole().Where(t => userRole.Contains(t.Role)).Select(t => t.Menu).Distinct(); var menu = _menuServices.GetVMenu().ToList(); foreach (var item in menu) { item.Menu = item.Menu.Where(t => menuRole.Contains(t.Id)); } menu = menu.Where(t => t.Menu.Any()).ToList(); return(menu); }