예제 #1
0
        private void Handle(ProductRemovedFromCart evt)
        {
            var cart = db.GetCartById(evt.CartId);

            cart.Items.RemoveAll(x => x.ProductId == evt.ProductId);
            db.SaveCart(cart);
        }
        public void Handle(ProductRemovedFromCart evt)
        {
            var cart = context.GetCartById(evt.CartId);

            cart.Items.RemoveAll(x => x.ProductId == evt.ProductId);
            context.SaveCart(cart);
        }
예제 #3
0
        public async Task HandleAsync(ProductRemovedFromCart @event)
        {
            await ExecuteSaveAsync(@event.AggregateId, cart =>
            {
                var productItems = cart.Items.Where(item => item.ProductId == @event.ProductId);
                var cartItems    = cart.Items.Concat(productItems.Skip(1));

                return(new ShoppingCartReadModel(cart, cartItems));
            });
        }
예제 #4
0
        private void Apply(ProductRemovedFromCart evt)
        {
            var item = Enumerable.SingleOrDefault(_shoppingCartItems, sci => sci.ProductId == evt.ProductId);

            if (item == null)
            {
                return;
            }

            if (item.Quantity > 1)
            {
                item.RemoveItems(1);
            }
            else
            {
                _shoppingCartItems.Remove(item);
            }
        }
예제 #5
0
 private void Apply(ProductRemovedFromCart evt)
 {
     products.Remove(evt.ProductId);
 }
예제 #6
0
        public void RemoveProduct(Guid productId, int quantity)
        {
            var ev = new ProductRemovedFromCart(AggregateId, productId, quantity);

            AddEvent(ev);
        }
예제 #7
0
 public void Handle(ProductRemovedFromCart evt)
 {
     Model.ProductRemovedFromCart(evt.CartId, evt.ProductId, evt.Quantity, evt.Timestamp);
 }
 private void btnRemove_Click(object sender, EventArgs e)
 {
     ProductRemovedFromCart?.Invoke(_item);
 }
예제 #9
0
 private void ShoppingCartControl_ProductRemovedFromCart(products_in_shop item)
 {
     ProductRemovedFromCart?.Invoke(item);
 }
예제 #10
0
 protected void OnProductRemovedFromCart(ProductRemovedFromCart productRemovedFromCart)
 {
     _products.Remove(productRemovedFromCart.ProductId);
 }