private async Task GrantRolesToUserAsync(IEnumerable <int> grantedRoleIds, User user) { var userRoles = grantedRoleIds .Select(roleId => new UserRole { RoleId = roleId, UserId = user.Id }) .ToList(); await _userRoleRepository.AddRangeAsync(userRoles).ConfigureAwait(false); }
public async Task ChangeUserRoleAsync(ChangeUserRoleCommand command) { await _userRoleRepository.AddRangeAsync(command.RoleIds, command.UserId); }