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); }
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)); }); }
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); } }
private void Apply(ProductRemovedFromCart evt) { products.Remove(evt.ProductId); }
public void RemoveProduct(Guid productId, int quantity) { var ev = new ProductRemovedFromCart(AggregateId, productId, quantity); AddEvent(ev); }
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); }
private void ShoppingCartControl_ProductRemovedFromCart(products_in_shop item) { ProductRemovedFromCart?.Invoke(item); }
protected void OnProductRemovedFromCart(ProductRemovedFromCart productRemovedFromCart) { _products.Remove(productRemovedFromCart.ProductId); }