public static string GetHeaderLink(PaginationHeader header) { var rows = new List <string>(); if (!string.IsNullOrEmpty(header.Prev)) { rows.Add($@"<{header.Prev}>; rel=""prev"""); } if (!string.IsNullOrEmpty(header.Next)) { rows.Add($@"<{header.Next}>; rel=""next"""); } if (!string.IsNullOrEmpty(header.First)) { rows.Add($@"<{header.First}>; rel=""first"""); } if (!string.IsNullOrEmpty(header.Last)) { rows.Add($@"<{header.Last}>; rel=""last"""); } return(string.Join(",", rows)); }
public static dynamic GetResultObject(IEnumerable <dynamic> results, int totalCount, PaginationHeader pg, QueryOptions options) { var result = new Dictionary <string, object> { ["results"] = results, ["link"] = pg, ["count"] = totalCount, [options.SkipWord] = options.Skip, [options.TakeWord] = options.Take }; return(result); }