예제 #1
0
        public async Task <IActionResult> GetUsers([FromQuery] UserParams userParams)
        {
            var usersFromRepo = await _repo.GetUsersAsync(userParams);

            var users = _mapper.Map <IEnumerable <UserToReturnDto> >(usersFromRepo);

            foreach (var user in users)
            {
                var userTemp = await _userManager.FindByEmailAsync(user.Email);

                var roles = await _userManager.GetRolesAsync(userTemp);

                user.Roles = roles;
            }

            return(Ok(new { users, userParams.Length }));
        }