Ejemplo n.º 1
0
        public ActionResult AuctionProductUpdate(AuctionModel.AuctionProductModel model)
        {
            //if (!_permissionService.Authorize(StandardPermissionProvider.ManageProducts))
            //    return AccessDeniedView();

            var relatedProduct = _productService.GetRelatedProductById(model.Id);

            if (relatedProduct == null)
            {
                throw new ArgumentException("No related product found with the specified id");
            }

            //a vendor should have access only to his products
            if (_workContext.CurrentVendor != null)
            {
                var product = _productService.GetProductById(relatedProduct.ProductId1);
                if (product != null && product.VendorId != _workContext.CurrentVendor.Id)
                {
                    return(Content("This is not your product"));
                }
            }

            relatedProduct.DisplayOrder = model.DisplayOrder;
            _productService.UpdateRelatedProduct(relatedProduct);

            return(new NullJsonResult());
        }
Ejemplo n.º 2
0
        public ActionResult AuctionProductList(DataSourceRequest command, int auctionId)
        {
            //if (!_permissionService.Authorize(StandardPermissionProvider.ManageProducts))
            //    return AccessDeniedView();

            //a vendor should have access only to his products
            if (_workContext.CurrentVendor != null)
            {
                //var product = _productService.GetProductById(auctionId);
                //if (product != null && product.VendorId != _workContext.CurrentVendor.Id)
                //{
                //    return Content("This is not your product");
                //}
            }

            var auction             = _auctionService.GetAuctionById(auctionId);
            var auctionProduct      = _auctionService.GetAuctionedProductByAuctionId(auctionId);
            var auctionProductModel =
                new AuctionModel.AuctionProductModel
            {
                AuctionId   = auctionId,
                ProductId   = auctionProduct.Id,
                ProductName = auctionProduct.Name,
                Status      = auction.Status
            };
            List <AuctionModel.AuctionProductModel> auctionProductModels = new List <AuctionModel.AuctionProductModel>
            {
                auctionProductModel
            };

            var gridModel = new DataSourceResult
            {
                Data  = auctionProductModels,
                Total = auctionProductModels.Count
            };

            return(Json(gridModel));
        }