public async Task <IActionResult> Get([FromQuery] int pageNumber, [FromQuery] int pageSize)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest(new ErrorResponse(ModelState)));
                }
                var users = await _userService.GetAllAsync();

                var dtoUsers = Mapper.Map <List <Dto_User> >(users);
                if (PaginatedList.IsValid(pageNumber, pageSize))
                {
                    PaginatedList paginatedUsers = new PaginatedList <Dto_User>(dtoUsers, pageNumber, pageSize);
                    return(Ok(paginatedUsers));
                }
                return(Ok(dtoUsers));
            }
            catch (PaginationException ex)
            {
                return(BadRequest(new ErrorResponse(ex)));
            }
            catch (NotFoundException ex)
            {
                return(NotFound(new ErrorResponse(ex)));
            }
            catch (Exception)
            {
                return(StatusCode(StatusCodes.Status500InternalServerError));
            }
        }
        public async Task <IActionResult> GetByFeatured([FromQuery] int pageNumber, [FromQuery] int pageSize)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest(new ErrorResponse(ModelState)));
                }
                var games = await _gameService.GetFeaturedAsync();

                var dtoGames = Mapper.Map <List <Dto_Game> >(games);
                if (PaginatedList.IsValid(pageNumber, pageSize))
                {
                    PaginatedList paginatedGames = new PaginatedList <Dto_Game>(dtoGames, pageNumber, pageSize);
                    return(Ok(paginatedGames));
                }
                return(Ok(dtoGames));
            }
            catch (NotFoundException ex)
            {
                return(NotFound(new ErrorResponse(ex)));
            }
            catch (Exception)
            {
                return(StatusCode(StatusCodes.Status500InternalServerError));
            }
        }
 public async Task <IActionResult> GetCollaborators([FromRoute] int gameId, [FromQuery] int pageNumber, [FromQuery] int pageSize, [FromQuery] bool non)
 {
     try
     {
         if (!ModelState.IsValid)
         {
             return(BadRequest(new ErrorResponse(ModelState)));
         }
         List <DbEntity_User> collaborators;
         if (non)
         {
             collaborators = await _gameService.GetNonCollaboratorsAsync(gameId);
         }
         else
         {
             collaborators = await _gameService.GetCollaboratorsAsync(gameId);
         }
         var dtoCollaborators = Mapper.Map <List <Dto_User> >(collaborators);
         if (PaginatedList.IsValid(pageNumber, pageSize))
         {
             PaginatedList paginatedUsers = new PaginatedList <Dto_User>(dtoCollaborators, pageNumber, pageSize);
             return(Ok(paginatedUsers));
         }
         return(Ok(dtoCollaborators));
     }
     catch (PaginationException ex)
     {
         return(BadRequest(new ErrorResponse(ex)));
     }
     catch (NotFoundException ex)
     {
         return(BadRequest(new ErrorResponse(ex)));
     }
     catch (Exception)
     {
         return(StatusCode(StatusCodes.Status500InternalServerError));
     }
 }