Example #1
0
        public async Task <IActionResult> GetCategories([FromQuery] int pageNumber = 1,
                                                        [FromQuery] int pageSize   = Constants.PageSize)
        {
            List <GenericLookupResult> categories = await _pokedexAPILogic.GetAllCategories();

            PagedResult <GenericLookupResult> pagedCategories =
                _paginationHelper.GetPagedResults(categories, pageNumber, pageSize);

            return(Ok(pagedCategories.Data));
        }
Example #2
0
        public async Task <IActionResult> GetNationalDex([FromQuery] int pageNumber = 1,
                                                         [FromQuery] int pageSize   = Constants.PageSize)
        {
            List <GenericPokemonResult> nationalDex = await _pokedexAPILogic.GetNationalDex();

            PagedResult <GenericPokemonResult> pagedNationalDex =
                _paginationHelper.GetPagedResults(nationalDex, pageNumber, pageSize);

            return(Ok(pagedNationalDex.Data));
        }
Example #3
0
        public async Task <IActionResult> Index(int pageNumber = 1, int pageSize = Constants.PageSize)
        {
            try
            {
                IEnumerable <PokemonListingViewModel> nationalDex = await _pokedexAppLogic.GetNationalDex();

                PagedResult <PokemonListingViewModel> pagedNationalDex = _paginationHelper.GetPagedResults(nationalDex, pageNumber, pageSize);

                return(View(pagedNationalDex));
            }
            catch (Exception ex)
            {
                return(Error(ex));
            }
        }