public ActionResult NeverSoldReportList(GridCommand command, NeverSoldReportModel model) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageOrders)) return Content(""); //a vendor should have access only to his products int vendorId = 0; if (_workContext.CurrentVendor != null) vendorId = _workContext.CurrentVendor.Id; DateTime? startDateValue = (model.StartDate == null) ? null : (DateTime?)_dateTimeHelper.ConvertToUtcTime(model.StartDate.Value, _dateTimeHelper.CurrentTimeZone); DateTime? endDateValue = (model.EndDate == null) ? null : (DateTime?)_dateTimeHelper.ConvertToUtcTime(model.EndDate.Value, _dateTimeHelper.CurrentTimeZone).AddDays(1); var items = _orderReportService.ProductsNeverSold(vendorId, startDateValue, endDateValue, command.Page - 1, command.PageSize, true); var gridModel = new GridModel<NeverSoldReportLineModel> { Data = items.Select(x => new NeverSoldReportLineModel() { ProductVariantId = x.Id, ProductVariantFullName = x.Product.Name + " " + x.Name, }), Total = items.TotalCount }; return new JsonResult { Data = gridModel }; }
public ActionResult NeverSoldReport() { if (!_permissionService.Authorize(StandardPermissionProvider.ManageOrders)) return AccessDeniedView(); var model = new NeverSoldReportModel(); return View(model); }