Esempio n. 1
0
        /// <summary>
        /// Gets the previous link
        /// </summary>
        /// <param name="offset">The current offset</param>
        /// <param name="limit">The current limit</param>
        /// <param name="count">The total items</param>
        /// <returns></returns>
        private PaginationLink GetPreviousLink(int offset, int limit)
        {
            if (offset == 0)
            {
                return(null);
            }

            int previousLimit, previousOffset;

            if (offset < limit)
            {
                previousOffset = 0;
                previousLimit  = offset;
            }
            else
            {
                previousOffset = offset - limit;
                previousLimit  = limit;
            }

            return(new PaginationLink(_routeContext.GetUpdatedPaginationFormattedUrl(previousOffset, previousLimit), "previous", HttpMethod.Get));
        }