using System.Text.Json.Serialization; namespace Generic.Contracts.Generics { public class Pagination { public int? PageSize { get; set; } public int? CurrentPage { get; set; } [JsonIgnore] public int? ItemsCount { get; set; } = 0; [JsonIgnore] public int? TotalPages { get { if (ItemsCount == null || ItemsCount == 0) return 0; if (PageSize == null || PageSize == 0) return 1; return (int)Math.Ceiling((decimal)ItemsCount / (decimal)PageSize.Value); } } } }