You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
OptifitWebService/Shared/PaginatedResult.cs

26 lines
631 B

namespace Shared;
public class PaginatedResult<T>
{
public PaginatedResult(List<T>? data = default, int count = 0, int page = 0, int pageSize = 10)
{
Data = data;
CurrentPage = page;
PageSize = pageSize;
TotalCount = count;
}
public List<T>? Data { get; set; }
public int CurrentPage { get; set; }
public int TotalCount { get; set; }
public int PageSize { get; set; }
public int TotalPages => (int)Math.Ceiling(TotalCount / (double)PageSize);
public bool HasPreviousPage => CurrentPage > 0;
public bool HasNextPage => CurrentPage < (TotalPages - 1);
}