public async Task <PageList <User> > GetUsers(UserParms userParms)
        {
            var users = _context.Users.Include(p => p.Photos).OrderByDescending(u => u.LastActive).AsQueryable();

            users = users.Where(u => u.Id != userParms.UserId);

            users = users.Where(u => u.Gender == userParms.Gender);

            if (userParms.Likers)
            {
                var userLiker = await GetUserLikes(userParms.UserId, userParms.Likers);

                users = users.Where(x => userLiker.Contains(x.Id));
            }

            if (userParms.Likees)
            {
                var userLikees = await GetUserLikes(userParms.UserId, userParms.Likers);

                var lst = userLikees.ToList();
                users = users.Where(x => userLikees.Contains(x.Id));
            }

            if (userParms.MinAge != 18 || userParms.MaxAge != 99)
            {
                var minDob = DateTime.Today.AddYears(-userParms.MaxAge - 1);
                var maxDob = DateTime.Today.AddYears(-userParms.MinAge);
                users = users.Where(u => u.DateOfBirth >= minDob && u.DateOfBirth <= maxDob);
            }

            if (!string.IsNullOrEmpty(userParms.OrderBy))
            {
                switch (userParms.OrderBy)
                {
                case "created":
                    users = users.OrderBy(u => u.Created);
                    break;

                default:
                    users = users.OrderByDescending(u => u.LastActive);
                    break;
                }
            }

            return(await PageList <User> .CreateAsync(users, userParms.PageNumber, userParms.PageSize));
        }
        public async Task <IActionResult> GetUsers([FromQuery] UserParms userParms)
        {
            var currentUserid = int.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value);
            var userFromRepo  = await _repo.GetUser(currentUserid);

            userParms.UserId = currentUserid;

            if (string.IsNullOrEmpty(userParms.Gender))
            {
                userParms.Gender = userFromRepo.Gender == "male" ? "female" : "male";
            }

            var users = await _repo.GetUsers(userParms);

            var usesToReturn = _mapper.Map <IEnumerable <UserForListsDto> > (users);

            Response.AddPagination(users.CurrentPage, users.PageSize, users.TotalCount, users.TotalPage);

            return(Ok(usesToReturn));
        }