Created
February 2, 2021 16:32
-
-
Save SibeeshVenu/d0483db658f83d51053b70f4e07a8899 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public async Task < IEnumerable < UserDto >> GetUserList(Guid selectedTenant) { | |
_logger.LogInformation($ "The method {nameof(GetUserList)} is called"); | |
var appUsers = await _adminRepository.GetUsersWithRole(selectedTenant); | |
if (!appUsers.Any()) throw AdminException.FromCode(ErrorCode.NoUsersInDbSelectedTenant); | |
var users = await _graphFacade.GetUsersUsingGraph(selectedTenant); | |
if (!users.Any()) throw AdminException.FromCode(ErrorCode.NoUsersInAdSelectedTenant); | |
var combinedList = appUsers.Join(users, app = >app.UserId, graph =>new Guid(graph.Id), (app, graph) = >new UserDto { | |
DisplayName = graph.DisplayName, | |
UserName = graph.UserPrincipalName, | |
Role = app.UserRole, | |
UserId = app.UserId | |
}).ToList < UserDto > (); | |
_logger.LogInformation($ "Succesfully executed the method {nameof(GetUserList)}"); | |
return combinedList; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment