This commit is contained in:
@@ -1,42 +0,0 @@
|
||||
// using System.Collections.Generic;
|
||||
// using AyaNova.Models;
|
||||
|
||||
// namespace AyaNova.Api.ControllerHelpers
|
||||
// {
|
||||
|
||||
|
||||
|
||||
// // public class ApiPagedResponse<T>
|
||||
// // {
|
||||
|
||||
// // public T[] items { get; }
|
||||
// // public object PageLinks { get; }
|
||||
// // public object Columns { get; }
|
||||
|
||||
// // public ApiPagedResponse(T[] returnItems, object pageLinks, object columns = null)
|
||||
// // {
|
||||
// // items = returnItems;
|
||||
// // PageLinks = pageLinks;
|
||||
// // Columns = Columns;
|
||||
|
||||
// // }
|
||||
// // }//eoc
|
||||
|
||||
// public class ApiPagedResponse
|
||||
// {
|
||||
|
||||
// public object items { get; }
|
||||
// public object PageLinks { get; }
|
||||
// public Newtonsoft.Json.Linq.JArray Columns { get; }
|
||||
|
||||
// public ApiPagedResponse(object returnItems, object pageLinks, Newtonsoft.Json.Linq.JArray columns)
|
||||
// {
|
||||
// items = returnItems;
|
||||
// PageLinks = pageLinks;
|
||||
// Columns = columns;
|
||||
|
||||
// }
|
||||
// }//eoc
|
||||
|
||||
|
||||
// }//eons
|
||||
@@ -1,89 +0,0 @@
|
||||
// using System;
|
||||
// using Microsoft.AspNetCore.Routing;
|
||||
// using Microsoft.AspNetCore.Mvc;
|
||||
// using Newtonsoft.Json;
|
||||
|
||||
// namespace AyaNova.Api.ControllerHelpers
|
||||
// {
|
||||
|
||||
// public class PaginationLinkBuilder
|
||||
// { //adapted from //https://www.jerriepelser.com/blog/paging-in-aspnet-webapi-pagination-links/
|
||||
// public Uri FirstPage { get; private set; }
|
||||
// public Uri LastPage { get; private set; }
|
||||
// public Uri NextPage { get; private set; }
|
||||
// public Uri PreviousPage { get; private set; }
|
||||
// public ListOptions PagingOptions { get; }
|
||||
// public long TotalRecordCount { get; }
|
||||
|
||||
// public PaginationLinkBuilder(IUrlHelper urlHelper, string routeName, object routeValues, ListOptions pagingOptions, long totalRecordCount)
|
||||
// {
|
||||
// PagingOptions = pagingOptions;
|
||||
// TotalRecordCount = totalRecordCount;
|
||||
|
||||
// // Determine total number of pages
|
||||
// var pageCount = totalRecordCount > 0
|
||||
// ? (int)Math.Ceiling(totalRecordCount / (double)pagingOptions.Limit)
|
||||
// : 0;
|
||||
|
||||
// // Create page links
|
||||
|
||||
// FirstPage = new Uri(urlHelper.Link(routeName, new RouteValueDictionary(routeValues)
|
||||
// {
|
||||
// {"pageNo", 1},
|
||||
// {"pageSize", pagingOptions.Limit}
|
||||
// }));
|
||||
|
||||
|
||||
// LastPage = new Uri(urlHelper.Link(routeName, new RouteValueDictionary(routeValues)
|
||||
// {
|
||||
// {"pageNo", pageCount},
|
||||
// {"pageSize", pagingOptions.Limit}
|
||||
// }));
|
||||
|
||||
// if (pagingOptions.Offset > 1)
|
||||
// {
|
||||
// PreviousPage = new Uri(urlHelper.Link(routeName, new RouteValueDictionary(routeValues)
|
||||
// {
|
||||
// {"pageNo", pagingOptions.Offset - 1},
|
||||
// {"pageSize", pagingOptions.Limit}
|
||||
// }));
|
||||
// }
|
||||
|
||||
|
||||
|
||||
// if (pagingOptions.Offset < pageCount)
|
||||
// {
|
||||
// NextPage = new Uri(urlHelper.Link(routeName, new RouteValueDictionary(routeValues)
|
||||
// {
|
||||
// {"pageNo", pagingOptions.Offset + 1},
|
||||
// {"pageSize", pagingOptions.Limit}
|
||||
// }));
|
||||
// }
|
||||
|
||||
|
||||
// }
|
||||
|
||||
|
||||
|
||||
// /// <summary>
|
||||
// /// Return paging data suitable for API return
|
||||
// /// </summary>
|
||||
// /// <returns></returns>
|
||||
// public Object PagingLinksObject()
|
||||
// {
|
||||
// return new
|
||||
// {
|
||||
// Count = TotalRecordCount,
|
||||
// Offset = PagingOptions.Offset,
|
||||
// Limit = PagingOptions.Limit,
|
||||
// First = FirstPage,
|
||||
// Previous = PreviousPage,
|
||||
// Next = NextPage,
|
||||
// Last = LastPage
|
||||
// };
|
||||
// }
|
||||
|
||||
|
||||
// }
|
||||
|
||||
// }
|
||||
Reference in New Issue
Block a user