Created
July 2, 2014 17:06
-
-
Save rushfrisby/b70df9b530423428e604 to your computer and use it in GitHub Desktop.
PagedResultSet used for paging
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
public class PagedResultSet<T> | |
{ | |
private int _endRecord; | |
private int _startRecord; | |
public PagedResultSet() | |
{ | |
PageResults = new List<T>(); | |
TotalRecords = 0; | |
StartRecord = 0; | |
EndRecord = 0; | |
} | |
public int EndRecord | |
{ | |
get { return _endRecord > TotalRecords ? TotalRecords : _endRecord; } | |
set { _endRecord = value; } | |
} | |
public bool HasNextPage | |
{ | |
get { return TotalRecords > EndRecord; } | |
} | |
public bool HasPreviousPage | |
{ | |
get { return StartRecord - 1 > 0; } | |
} | |
public ICollection<T> PageResults { get; set; } | |
public int StartRecord | |
{ | |
get { return TotalRecords > 0 ? _startRecord : 0; } | |
set { _startRecord = value; } | |
} | |
public int TotalRecords { get; set; } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment