Exemplo n.º 1
0
        public IActionResult List(DataSourceRequest command, ProductReviewListModel model)
        {
            var productReviews = _productReviewViewModelService.PrepareProductReviewsModel(model, command.Page, command.PageSize);
            var gridModel      = new DataSourceResult
            {
                Data  = productReviews.productReviewModels.ToList(),
                Total = productReviews.totalCount,
            };

            return(Json(gridModel));
        }
        public async Task <IActionResult> List(DataSourceRequest command, ProductReviewListModel model)
        {
            var(productReviewModels, totalCount) = await _productReviewViewModelService.PrepareProductReviewsModel(model, command.Page, command.PageSize);

            var gridModel = new DataSourceResult
            {
                Data  = productReviewModels.ToList(),
                Total = totalCount,
            };

            return(Json(gridModel));
        }
        public async Task<IActionResult> List(DataSourceRequest command, ProductReviewListModel model)
        {
            //limit for store manager
            if (_workContext.CurrentCustomer.IsStaff())
                model.SearchStoreId = _workContext.CurrentCustomer.StaffStoreId;

            var (productReviewModels, totalCount) = await _productReviewViewModelService.PrepareProductReviewsModel(model, command.Page, command.PageSize);
            var gridModel = new DataSourceResult {
                Data = productReviewModels.ToList(),
                Total = totalCount,
            };

            return Json(gridModel);
        }