Skip to content

Instantly share code, notes, and snippets.

@rushfrisby
Created July 2, 2014 17:06
Show Gist options
  • Save rushfrisby/b70df9b530423428e604 to your computer and use it in GitHub Desktop.
Save rushfrisby/b70df9b530423428e604 to your computer and use it in GitHub Desktop.
PagedResultSet used for paging
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