コード例 #1
0
        private string CreateVehicleUri(PaginationBase parameters, PaginationUriType uriType)
        {
            switch (uriType)
            {
            case PaginationUriType.PreviousPage:
                var previousParameters = parameters.Clone();
                previousParameters.PageIndex--;
                return(_urlHelper.Link("GetPagedVehicles", previousParameters));

            case PaginationUriType.NextPage:
                var nextParameters = parameters.Clone();
                nextParameters.PageIndex++;
                return(_urlHelper.Link("GetPagedVehicles", nextParameters));

            case PaginationUriType.CurrentPage:
            default:
                return(_urlHelper.Link("GetPagedVehicles", parameters));
            }
        }
コード例 #2
0
        /// <summary>
        /// 创建向前向后url
        /// </summary>
        /// <param name="userPagination">分页实体</param>
        /// <param name="paginationResourceUriType">分页url类型</param>
        /// <returns></returns>
        string CreateUserUri(PaginationBase userPagination, PaginationResourceUriType paginationResourceUriType)
        {
            switch (paginationResourceUriType)
            {
            case PaginationResourceUriType.PreviousPage:
                var previousParmeters = userPagination.Clone();
                previousParmeters.PageIndex--;
                var res = _urlHelper.RouteUrl(previousParmeters);
                return(res);

            case PaginationResourceUriType.NextPage:
                var nextParmeters = userPagination.Clone();
                nextParmeters.PageIndex++;
                return(_urlHelper.RouteUrl(nextParmeters));

            default:
                return(_urlHelper.RouteUrl(userPagination));
            }
        }
コード例 #3
0
        private string CreateBuildingUri(PaginationBase parameters, PaginationResourceUriType_uriType uriType)
        {
            switch (uriType)
            {
            case PaginationResourceUriType_uriType.pagePre:
                var previousParameters = parameters.Clone();
                previousParameters.PageIndex--;
                return(_urlHelper.Link("GetBuildings", previousParameters));

            case PaginationResourceUriType_uriType.pageCurren:
                var currentParameters = parameters.Clone();
                return(_urlHelper.Link("GetBuildings", currentParameters));

            case PaginationResourceUriType_uriType.pageNext:
                var nextParameters = parameters.Clone();
                nextParameters.PageIndex++;
                return(_urlHelper.Link("GetBuildings", nextParameters));

            default:
                return(_urlHelper.Link("GetBuildings", parameters));
            }
        }