Skip to content

ThiagoBarradas/pagedlist-netcore

Repository files navigation

Build status codecov NuGet Downloads NuGet Version

PagedList

Paged list for .NET applications

Utilization with basic navigation

Create new pagination object

string originUrl = "http://www.myapp.com/list?filterA=xyz&filterB=123=123&pageSize=10&pageNumber=5";

int itemCount = 347;

int pageSize = 10;

int pageNumber = 5;

PagedList pagedList = new PagedList(originUrl, itemCount, pageNumber, pageSize);

Object structure

{
	"options" : {
		"pageNumber" : 5,
		"pageSize" : 10,
		"itemCount" : 347,
		"pageCount" : 35
	},
	"navigator" : {
		"navigatorSize" : null,
		"first" : {
			"url" : "http://www.myapp.com/list?filterA=xyz&filterB=123=123&pageSize=10&pageNumber=1",
			"number" : 1
		},
		"previous" : {
			"url" : "http://www.myapp.com/list?filterA=xyz&filterB=123=123&pageSize=10&pageNumber=4",
			"number" : 4
		},
		"next" : {
			"url" : "http://www.myapp.com/list?filterA=xyz&filterB=123=123&pageSize=10&pageNumber=6",
			"number" : 6
		},
		"last" : {
			"url" : "http://www.myapp.com/list?filterA=xyz&filterB=123=123&pageSize=10&pageNumber=35",
			"number" : 35
		},
		"numerics" : null
	}
}

Utilization with basic and numeric navigation

Create new pagination object

string originUrl = "http://www.myapp.com/list?filterA=xyz&filterB=123=123&pageSize=10&pageNumber=5";

int itemCount = 347;

int pageSize = 10;

int pageNumber = 5;

int navigatorSize = 10;

PagedList pagedList = new PagedList(originUrl, itemCount, pageNumber, pageSize, navigatorSize);

Object structure

{  
   "options":{  
      "pageNumber":5,
      "pageSize":10,
      "itemCount":347,
      "pageCount":35
   },
   "navigator":{  
      "navigatorSize":10,
      "first":{  
         "url":"http://www.myapp.com/list?filterA=xyz&filterB=123=123&pageSize=10&pageNumber=1",
         "number":1
      },
      "previous":{  
         "url":"http://www.myapp.com/list?filterA=xyz&filterB=123=123&pageSize=10&pageNumber=4",
         "number":4
      },
      "next":{  
         "url":"http://www.myapp.com/list?filterA=xyz&filterB=123=123&pageSize=10&pageNumber=6",
         "number":6
      },
      "last":{  
         "url":"http://www.myapp.com/list?filterA=xyz&filterB=123&pageSize=10&pageNumber=35",
         "number":35
      },
      "numerics":[  
         {  
            "url":"http://www.myapp.com/list?filterA=xyz&filterB=123&pageSize=10&pageNumber=1",
            "number":1
         },
         {  
            "url":"http://www.myapp.com/list?filterA=xyz&filterB=123&pageSize=10&pageNumber=2",
            "number":2
         },
         {  
            "url":"http://www.myapp.com/list?filterA=xyz&filterB=123&pageSize=10&pageNumber=3",
            "number":3
         },
         {  
            "url":"http://www.myapp.com/list?filterA=xyz&filterB=123&pageSize=10&pageNumber=4",
            "number":4
         },
         {  
            "url":"http://www.myapp.com/list?filterA=xyz&filterB=123&pageSize=10&pageNumber=5",
            "number":5
         },
         {  
            "url":"http://www.myapp.com/list?filterA=xyz&filterB=123&pageSize=10&pageNumber=6",
            "number":6
         },
         {  
            "url":"http://www.myapp.com/list?filterA=xyz&filterB=123&pageSize=10&pageNumber=7",
            "number":7
         },
         {  
            "url":"http://www.myapp.com/list?filterA=xyz&filterB=123&pageSize=10&pageNumber=8",
            "number":8
         },
         {  
            "url":"http://www.myapp.com/list?filterA=xyz&filterB=123&pageSize=10&pageNumber=9",
            "number":9
         },
         {  
            "url":"http://www.myapp.com/list?filterA=xyz&filterB=123&pageSize=10&pageNumber=10",
            "number":10
         }
      ]
   }
}

Some response samples

For this examples, the numeric navigator is defined as 3.

Current page is the first

{  
   "options":{  
      "pageNumber":1,
      "pageSize":10,
      "itemCount":347,
      "pageCount":35
   },
   "navigator":{  
      "navigatorSize":3,
      "first":null,
      "previous":null,
      "next":{  
         "url":"http://www.myapp.com/list?filterA=xyz&filterB=123&pageSize=10&pageNumber=2",
         "number":2
      },
      "last":{  
         "url":"http://www.myapp.com/list?filterA=xyz&filterB=123&pageSize=10&pageNumber=35",
         "number":35
      },
      "numerics":[  
         {  
            "url":"http://www.myapp.com/list?filterA=xyz&filterB=123&pageSize=10&pageNumber=1",
            "number":1
         },
         {  
            "url":"http://www.myapp.com/list?filterA=xyz&filterB=123&pageSize=10&pageNumber=2",
            "number":2
         },
         {  
            "url":"http://www.myapp.com/list?filterA=xyz&filterB=123&pageSize=10&pageNumber=3",
            "number":3
         }
      ]
   }
}

Current page is the last

{  
   "options":{  
      "pageNumber":35,
      "pageSize":10,
      "itemCount":347,
      "pageCount":35
   },
   "navigator":{  
      "navigatorSize":3,
      "first":{  
         "url":"http://www.myapp.com/list?filterA=xyz&filterB=123&pageSize=10&pageNumber=1",
         "number":1
      },
      "previous":{  
         "url":"http://www.myapp.com/list?filterA=xyz&filterB=123&pageSize=10&pageNumber=34",
         "number":34
      },
      "next":null,
      "last":null,
      "numerics":[  
         {  
            "url":"http://www.myapp.com/list?filterA=xyz&filterB=123&pageSize=10&pageNumber=33",
            "number":33
         },
         {  
            "url":"http://www.myapp.com/list?filterA=xyz&filterB=123&pageSize=10&pageNumber=34",
            "number":34
         },
         {  
            "url":"http://www.myapp.com/list?filterA=xyz&filterB=123&pageSize=10&pageNumber=35",
            "number":35
         }
      ]
   }
}

One item to show - Single page

{  
   "options":{  
      "pageNumber":1,
      "pageSize":10,
      "itemCount":10,
      "pageCount":1
   },
   "navigator":{  
      "navigatorSize":3,
      "first":null,
      "previous":null,
      "next":null,
      "last":null,
      "numerics":[  
         {  
            "url":"http://www.myapp.com/list?filterA=xyz&filterB=123&pageSize=10&pageNumber=1",
            "number":1
         }
      ]
   }
}

Zero items to show

{  
   "options":{  
      "pageNumber":1,
      "pageSize":10,
      "itemCount":0,
      "pageCount":0
   },
   "navigator":{  
      "navigatorSize":3,
      "first":null,
      "previous":null,
      "next":null,
      "last":null,
      "numerics":null
   }
}

How can I contribute?

Please, refer to CONTRIBUTING

Found something strange or need a new feature?

Open a new Issue following our issue template ISSUE-TEMPLATE

Changelog

See in nuget version history

Did you like it? Please, make a donate :)

if you liked this project, please make a contribution and help to keep this and other initiatives, send me some Satochis.

BTC Wallet: 1G535x1rYdMo9CNdTGK3eG6XJddBHdaqfX

1G535x1rYdMo9CNdTGK3eG6XJddBHdaqfX

Releases

No releases published

Packages

No packages published

Languages