Esempio n. 1
0
        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);
                }
            }
        }
Esempio n. 2
0
        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);
                }
            }
        }
Esempio n. 3
0
        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));
 }
Esempio n. 6
0
        /// <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);
        }
Esempio n. 7
0
        /// <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);
            }
        }