private static int GetEndingPage(Pager pagerData, PagerSettings settings) { if (pagerData.TotalPages <= settings.NumberPagesToDisplay) { return(pagerData.TotalPages); } int range = PagerCalculator.GetRange(pagerData.CurrentPage, settings.NumberPagesToDisplay); int totalRanges = PagerCalculator.GetTotalRanges(pagerData.TotalPages, settings.NumberPagesToDisplay); if (range == totalRanges) { return(pagerData.TotalPages); } return(range * settings.NumberPagesToDisplay); }
private static int GetStartingPage(Pager pagerData, PagerSettings settings) { if (pagerData.CurrentPage <= settings.NumberPagesToDisplay) { return(1); } int num = PagerCalculator.GetRange(pagerData.CurrentPage, settings.NumberPagesToDisplay); int totalRanges = PagerCalculator.GetTotalRanges(pagerData.TotalPages, settings.NumberPagesToDisplay); if (num == totalRanges) { return(pagerData.TotalPages - settings.NumberPagesToDisplay + 1); } num--; return(num * settings.NumberPagesToDisplay + 1); }