public Basket UpdateBasket(Guid basketId, Item item)
        {
            var request  = new UpdateBasket(basketId, item);
            var response = request.Patch();

            if (string.IsNullOrWhiteSpace(response))
            {
                return(null);
            }
            return(JsonConvert.DeserializeObject <Basket>(response));
        }
Beispiel #2
0
        public ActionResult UpdateBasket(UpdateBasket model)
        {
            // The only thing that can be updated in this basket is the quantity
            foreach (var item in model.Items.Where(item => this.Basket.Items.First(x => x.Key == item.Key).Quantity != item.Quantity))
            {
                this.Basket.UpdateQuantity(item.Key, item.Quantity);
            }

            this.Basket.Save();

            return(this.RedirectToCurrentUmbracoPage());
        }
Beispiel #3
0
        public async Task <IActionResult> Put([FromBody] UpdateBasket value)
        {
            var basket = await this._repository.GetBasketAsync(value.BuyerId);

            basket.Items.ForEach(m =>
            {
                m.Quantity = value.Updates.First(i => i.BasketItemId == m.ProductId).NewQty;
            });

            var basket1 = await _repository.UpdateBasketAsync(basket);

            return(Ok(basket));
        }
        public async Task <IActionResult> UpdateBasket([FromBody] UpdateBasket command)
        {
            await _busPublisher.SendAsync(command, null);

            return(Accepted());
        }