Exemple #1
0
        public async Task <IActionResult> Index(PetListParameters petListParameters, int p = 1)
        {
            var result = await _genusService.List();

            if (result.Success)
            {
                ViewBag.Categories = result.Data;
            }


            var response = await _petApiService.List(petListParameters, p);

            if (response.Success)
            {
                var dataCount = await _petApiService.GetPetCount();

                var dtoList = new StaticPagedList <PetDto>(response.Data, p, 21, dataCount.Data);

                return(View(dtoList));
            }
            else
            {
                return(View(new PagedList <PetDto>(new List <PetDto>(), p, StaticVars.PaginationPageSize)));
            }
        }
Exemple #2
0
        public async Task <IActionResult> Index(int p = 1)
        {
            var response = await _petApiService.List(null, p, false);

            if (response.Success)
            {
                var dataCount = await _petApiService.GetPetCount();

                var dtoList = new StaticPagedList <PetDto>(response.Data, p, 21, dataCount.Data);

                return(View(dtoList));
            }
            else
            {
                return(View(new PagedList <PetDto>(new List <PetDto>(), p, StaticVars.PaginationPageSize)));
            }
        }