コード例 #1
0
        public async Task <IActionResult> GetUsers([FromQuery] UserParams userParams)
        {
            var userID       = int.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value);
            var userfromRepo = await _dating.GetUser(userID);

            userParams.UserID = userID;
            if (string.IsNullOrEmpty(userParams.Gender))
            {
                userParams.Gender = userfromRepo.Gender == "male" ? "female" : "male";
            }
            var Users = await _dating.GetAllUsers(userParams);

            var UsersToReturn = _mapper.Map <IEnumerable <UsersforListDto> >(Users);

            Response.AddPaginationHeader(Users.CurrentPage, userParams.pageSize, Users.TotalCount, Users.TotalPages);
            return(Ok(UsersToReturn));
        }