Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ID-JA committed Aug 6, 2021
1 parent 34e2a5e commit cf69c76
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
Binary file modified BACK_END/.vs/MY_CALS_BACKEND/DesignTimeBuild/.dtbcache.v2
Binary file not shown.
Binary file modified BACK_END/.vs/MY_CALS_BACKEND/v16/.suo
Binary file not shown.
24 changes: 22 additions & 2 deletions BACK_END/Controllers/AdminController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,27 @@ public AdminController(IRepoUserAccount repoUserAccount, IMapper mapper, UserMan
}


[HttpGet("users/all")]
[HttpGet("users/mangers")]
public async Task<IActionResult> GetManagers()
{
var users = _repoUserAccount.GetUsersAccounts();
var usersForDisplayDTO = new List<UserForDisplayDTO>();
foreach (var user in users)
{
var roleOfUser = await _userManager.GetRolesAsync(user);
var userForDisplayDTO = _mapper.Map<UserForDisplayDTO>(user);
userForDisplayDTO.Role = roleOfUser[0];

if (userForDisplayDTO.Role == "Manager")
{
usersForDisplayDTO.Add(userForDisplayDTO);
}
}
return Ok(usersForDisplayDTO);
}


[HttpGet("users")]
public async Task<IActionResult> GetUsers()
{
var users = _repoUserAccount.GetUsersAccounts();
Expand All @@ -51,7 +71,7 @@ public async Task<IActionResult> GetUsers()
var userForDisplayDTO = _mapper.Map<UserForDisplayDTO>(user);
userForDisplayDTO.Role = roleOfUser[0];

if (userForDisplayDTO.Role != "Admin")
if (userForDisplayDTO.Role == "Manager")
{
usersForDisplayDTO.Add(userForDisplayDTO);
}
Expand Down

0 comments on commit cf69c76

Please sign in to comment.