コード例 #1
0
 private static PaginationInfo CreatePageInfo(PageRequest paging, IEnumerable<Widget> all)
 {
     return new PaginationInfo(
         paging.Page,
         paging.AllowedPageSize(MaxPageSizeFromImaginaryConfiguration),
         all.Count());
 }
コード例 #2
0
 public Task<IHttpActionResult> Get([FromUri] PageRequest paging = null)
 {
     if (paging == null) { paging = new PageRequest(); }
     var all = FetchData();
     var historyPage = PageData(paging, all);
     var pageInfo = CreatePageInfo(paging, all);
     var result = Ok(historyPage);
     Request.Properties[PaginationInfo.PropertyKey] = pageInfo;
     return new Task<IHttpActionResult>(() => Ok(result));
 }
コード例 #3
0
 private static IList<Widget> PageData(PageRequest paging, IEnumerable<Widget> data)
 {
     return data.Page(paging.AllowedPageSize(MaxPageSizeFromImaginaryConfiguration), paging.Page).ToList();
 }