Pagination.cs 963 B

12345678910111213141516171819202122232425262728293031
  1. using MessagePack;
  2. using System;
  3. using System.Collections.Generic;
  4. namespace TEAMModelOS.SDK.Extension.DataResult.PageToken
  5. {
  6. [MessagePackObject(keyAsPropertyName: true)]
  7. public class Pagination
  8. {
  9. public long total { get; set; }
  10. public int currPage { get; set; }
  11. public int pageSize { get; set; }
  12. public int totalPage { get; set; }
  13. public Pagination() { }
  14. public Pagination(long total, int currPage, int pageSize)
  15. {
  16. this.total = total;
  17. this.currPage = currPage;
  18. this.pageSize = pageSize;
  19. this.totalPage = (int)Math.Ceiling((double)this.total / (double)this.pageSize);
  20. }
  21. public Pagination(long total, int currPage, int pageSize, int totalPage)
  22. {
  23. this.total = total;
  24. this.currPage = currPage;
  25. this.pageSize = pageSize;
  26. this.totalPage = totalPage;
  27. }
  28. }
  29. }