コード例 #1
0
        public ActionResult AddItemToBasket(int basketId, int basketItemId, int supplierId, int quantity)
        {
            var supplier = _supplierApi.All().FirstOrDefault(x => x.SupplierId == supplierId);
            var product  =
                _productApi.GetAllForSupplier(supplier).FirstOrDefault(x => x.ProductId == basketItemId);

            _orderApi.AddOrderBasketItem(new OrderBasketItemPost()
            {
                RetailerId      = 1,
                OrderBasketItem = new OrderBasketItem()
                {
                    OrderBasketId = basketId,
                    BarCode       = product.Barcode,
                    ProductId     = product.ProductId,
                    NumberOfUnits = quantity,
                    PricePerUnit  = product.Price,
                    ProductCode   = product.ProductCode,
                    ProductName   = product.ProductName,
                    TotalPrice    = quantity * product.Price,
                    UnitOfMeasure = product.UnitOfMeasureName
                }
            });
            return(OrderBasket(basketId));
        }