namespace DeepDrftModels.Models; public class PagedResult { public IEnumerable Items { get; set; } = new List(); public int TotalCount { get; set; } public int Page { get; set; } public int PageSize { get; set; } public int TotalPages => PageSize > 0 ? (int)Math.Ceiling((double)TotalCount / PageSize) : 0; public bool HasNextPage => Page < TotalPages; public bool HasPreviousPage => Page > 1; public PagedResult() { } public static PagedResult From(PagedResult other, IEnumerable items) { return new PagedResult() { Items = items.ToList(), Page = other.Page, PageSize = other.PageSize, TotalCount = other.TotalCount, }; } public PagedResult(IEnumerable items, int totalCount, int page, int pageSize) { Items = items.ToList(); TotalCount = totalCount; Page = page; PageSize = pageSize; } }