19 lines
502 B
C#
19 lines
502 B
C#
namespace UniVerse.Application.DTOs.Common;
|
|
|
|
public record PaginationRequest(int Page = 1, int PageSize = 20);
|
|
|
|
public record PagedResult<T>(
|
|
List<T> Items,
|
|
int TotalCount,
|
|
int Page,
|
|
int PageSize,
|
|
int TotalPages
|
|
)
|
|
{
|
|
public static PagedResult<T> Create(List<T> items, int totalCount, int page, int pageSize)
|
|
{
|
|
var totalPages = (int)Math.Ceiling(totalCount / (double)pageSize);
|
|
return new PagedResult<T>(items, totalCount, page, pageSize, totalPages);
|
|
}
|
|
}
|