24 lines
632 B
C#
24 lines
632 B
C#
namespace cuqmbr.TravelGuide.Application.Common.Models;
|
|
|
|
public class PaginatedList<T>
|
|
{
|
|
public IReadOnlyCollection<T> Items { get; }
|
|
public int PageNumber { get; }
|
|
public int TotalPages { get; }
|
|
public int TotalCount { get; }
|
|
|
|
public PaginatedList(
|
|
IReadOnlyCollection<T> items, int count,
|
|
int pageNumber, int pageSize)
|
|
{
|
|
PageNumber = pageNumber;
|
|
TotalPages = (int) Math.Ceiling(count / (double) pageSize);
|
|
TotalCount = count;
|
|
Items = items;
|
|
}
|
|
|
|
public bool HasPreviousPage => PageNumber > 1;
|
|
|
|
public bool HasNextPage => PageNumber < TotalPages;
|
|
}
|