Created
June 29, 2011 04:03
-
-
Save troygoode/1053069 to your computer and use it in GitHub Desktop.
PagedList Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const int pageSize = 10; | |
var allProducts = database.Products.All(); //15 products | |
//products 1-10 | |
var firstPage = allProducts.ToPagedList(0, pageSize); | |
Assert.Equal(10, firstPage.Count); | |
Assert.False(firstPage.HasPreviousPage); | |
Assert.True(firstPage.HasNextPage); | |
//products 11-15 | |
var secondPage = allProducts.ToPagedList(1, pageSize); | |
Assert.Equal(5, secondPage.Count); | |
Assert.False(secondPage.IsFirstPage); | |
Assert.True(secondPage.IsLastPage); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment