Пример #1
0
        private async Task <int> GetMaxPage(int PageSize)
        {
            int numProducts = await ClothingDb.GetNumClothing(_context);

            int maxPage = Convert.ToInt32(Math.Ceiling((double)numProducts / PageSize)); //need to cast a double for dividing of ints, then use Math.ceiling to go to next int up

            return(maxPage);
        }
Пример #2
0
        private async Task <int> GetMaxPage(int PageSize)
        {
            int numProducts = await ClothingDb.GetNumClothing(_context);

            int maxPage = Convert.ToInt32(Math.Ceiling((double)numProducts / PageSize));

            return(maxPage);
        }
Пример #3
0
        private async Task <int> GetMaxPage(int PageSize)
        {
            int numProducts = await ClothingDb.GetNumClothing(_context) / PageSize;

            // round up always, no partial page number (2.1 pages = 3 pages)
            int maxPage = Convert.ToInt32(Math.Ceiling((double)numProducts / PageSize));

            return(maxPage);
        }
        private async Task <int> GetMaxPage(int pageSize)
        {
            int NumProducts = await ClothingDb.GetNumClothing(_context);

            //num product and page size are both an int so to get the decimal you must convert to a double
            // than to round up you must use Math.Ceiling which is a double so you must convert back to int
            int maxPage = Convert.ToInt32
                              (Math.Ceiling((double)NumProducts / pageSize));

            return(maxPage);
        }