private Task <List <UserPermissionViewModel> > GetPermissionsByRoleAsync(int userId)
        {
            var roles = _getRolesByUserIdQuery.ExecuteAsync(userId).Result.Select(n => n.RoleId).ToList();

            var result = _permissionRepository.TableNoTracking
                         .Where(n => roles.Contains(n.RoleId))
                         .Select(n => new UserPermissionViewModel()
            {
                permissionId    = n.Id,
                permissionName  = n.Permission,
                permissionTitle = n.Title
            })
                         .ToListAsync();

            return(result);
        }
Beispiel #2
0
        public async Task <IActionResult> GetRolesByUserIdAsync(int userId)
        {
            var result = await _getRolesByUserIdQuery.ExecuteAsync(userId);

            return(new ObjectResult(result));
        }