public void AddPageLinks(IPageLinkContaining linkContainer, string currentPageQueryString, string previousPageQueryString, string nextPageQueryString) { var versionedBaseUri = _userSession.RequestUri.GetBaseUri(); AddCurrentPageLink(linkContainer, versionedBaseUri, currentPageQueryString); var addPrevPageLink = ShouldAddPreviousPageLink(linkContainer.PageNumber); var addNextPageLink = ShouldAddNextPageLink(linkContainer.PageNumber, linkContainer.PageCount); if (addPrevPageLink || addNextPageLink) { if (addPrevPageLink) { AddPreviousPageLink(linkContainer, versionedBaseUri, previousPageQueryString); } if (addNextPageLink) { AddNextPageLink(linkContainer, versionedBaseUri, nextPageQueryString); } } }
public virtual void AddNextPageLink(IPageLinkContaining linkContainer, Uri versionedBaseUri, string pageQueryString) { var uriBuilder = new UriBuilder(versionedBaseUri) { Query = pageQueryString }; linkContainer.AddLink(GetNextPageLink(uriBuilder.Uri)); }
public virtual void AddPreviousPageLink(IPageLinkContaining linkContainer, Uri versionedBaseUri, string pageQueryString) { var uriBuilder = new UriBuilder(versionedBaseUri) { Query = pageQueryString }; linkContainer.AddLink(GetPreviousPageLink(uriBuilder.Uri)); }
public virtual void AddCurrentPageLink(IPageLinkContaining linkContainer, Uri versionedBaseUri, string pageQueryString) { var currentPageUriBuilder = new UriBuilder(versionedBaseUri) { Query = pageQueryString }; linkContainer.AddLink(GetCurrentPageLink(currentPageUriBuilder.Uri)); }
/// <summary> /// Builds the proper Uri and ands the Link to the paged response /// </summary> public virtual void AddNextPageLink(IPageLinkContaining linkContainer, Uri versionedBaseUri) { var nextPageUriBuilder = new UriBuilder(versionedBaseUri) { Query = GetQueryString(linkContainer.PageNumber + 1, linkContainer.PageSize) }; var nextPageLink = GetLink( nextPageUriBuilder.Uri, Constants.CommonLinkRelValues.NextPage, HttpMethod.Get); linkContainer.AddLink(nextPageLink); }
/// <summary> /// Adds paging Links to a paged response /// </summary> public void AddPageLinks(IPageLinkContaining linkContainer) { var versionedBaseUri = _userSession.RequestUri.GetBaseUri(); AddCurrentPageLink(linkContainer, versionedBaseUri); var addPreviousPageLink = ShouldAddPreviousPageLink(linkContainer.PageNumber); if (addPreviousPageLink) { AddPreviousPageLink(linkContainer, versionedBaseUri); } var addNextPageLink = ShouldAddNextPageLink(linkContainer.PageNumber, linkContainer.PageCount); if (addNextPageLink) { AddNextPageLink(linkContainer, versionedBaseUri); } }