コード例 #1
0
        public ActionResult Index(int pageIndex = 1, int pageSize = 12, string filter = "", int stateProvinceId = 0, int countryRegionId = 0, int areaId = 0)
        {
            var model = _tourService.GetAll(pageIndex, pageSize, filter, stateProvinceId, countryRegionId, true, TourTypeProvider.TicketTour.Id, areaId);

            string queryParams = "";

            if (!string.IsNullOrWhiteSpace(filter))
            {
                queryParams += "&filter=" + filter;
            }
            if (stateProvinceId != 0)
            {
                queryParams += "&stateProvinceId=" + stateProvinceId;
            }
            if (countryRegionId != 0)
            {
                queryParams += "&countryRegionId=" + countryRegionId;
            }
            if (areaId != 0)
            {
                queryParams += "&areaId=" + areaId;
            }
            ViewBag.queryParams    = queryParams;
            ViewBag.countryRegions = _countryRegionService.GetAll(true);
            PaginationSet <TourDto> pagedSet = new PaginationSet <TourDto>()
            {
                Page       = pageIndex,
                TotalCount = model.TotalItemCount,
                TotalPages = (int)Math.Ceiling((decimal)model.TotalItemCount / pageSize),
                Items      = model
            };

            this.LoadDefaultMetaSEO();
            return(View(pagedSet));
        }
コード例 #2
0
        //[Authorize(Roles = nameof(PermissionProvider.ViewProduct))]
        public HttpResponseMessage getAll(HttpRequestMessage request,
                                          int page = 0, int pageSize = 20, string filter = "", int continentId = 0)
        {
            return(CreateHttpResponse(request, () =>
            {
                HttpResponseMessage response = null;
                var model = _countryRegionService.GetAll(page + 1, pageSize, filter, continentId);
                PaginationSet <CountryRegion> pagedSet = new PaginationSet <CountryRegion>()
                {
                    Page = page,
                    TotalCount = model.TotalItemCount,
                    TotalPages = (int)Math.Ceiling((decimal)model.TotalItemCount / pageSize),
                    Items = model
                };

                response = request.CreateResponse(HttpStatusCode.OK, pagedSet);

                return response;
            }));
        }