protected virtual DataSourceResult GetBestViewProductModel(int pageIndex, int pageSize) { //a vendor should have access only to his products int vendorId = 0; if (_workContext.CurrentVendor != null) { vendorId = _workContext.CurrentVendor.Id; } var items = _orderReportService.BestViewProductReport( vendorId: vendorId, pageIndex: pageIndex, pageSize: pageSize, showHidden: true); var gridModel = new DataSourceResult { Data = items.Select(x => { var m = new BestViewProductReportLineModel { ProductId = x.Id, ProductName = x.Name, TotalViewCount = x.ViewCount, }; return(m); }), Total = items.TotalCount }; return(gridModel); }