Ejemplo n.º 1
0
        public async Task <IActionResult> ShowAll(int?page)
        {
            const int PageSize = 2;
            // Null-coalescing operator ??
            // https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/operators/null-coalescing-operator
            int pageNumber = page ?? 1;

            ViewData["CurrentPage"] = pageNumber;

            int maxPage = await GetMaxPage(PageSize);

            ViewData["MaxPage"] = maxPage;

            List <Clothing> clothes =
                await ClothingDB.GetClothingbyPage(_context, pageNumber, PageSize);

            return(View(clothes));
        }