public ExpandoObject CreateLinkedentityWithmetadataObject <T>( PaginationMetaDataObject paginationMetadata, IEnumerable <T> objs, IEnumerable <LinksObject> links) { var objWithMetadata = new ExpandoObject(); ((IDictionary <string, object>)objWithMetadata).Add("metadata", paginationMetadata); ((IDictionary <string, object>)objWithMetadata).Add("records", objs); ((IDictionary <string, object>)objWithMetadata).Add("links", links); return(objWithMetadata); }
public PaginationMetaDataObject CreatePaginationMetadataObject <T>(PagedList <T> pagedlist, RequestParameters requestParameters, string routeName) { var previousPageLink = pagedlist.HasPrevious ? _paginationUrlHelper.CreateUrlForResource(requestParameters, PageType.PreviousPage, routeName) : null; var nextPageLink = pagedlist.HasNext ? _paginationUrlHelper.CreateUrlForResource(requestParameters, PageType.NextPage, routeName) : null; var paginationMetaData = new PaginationMetaDataObject() { TotalCount = pagedlist.TotalCount, PageSize = pagedlist.PageSize, CurrentPage = pagedlist.CurrentPage, TotalPages = pagedlist.TotalPages, PreviousPageLink = previousPageLink, NextPageLink = nextPageLink }; return(paginationMetaData); }