public async Task ExecuteAsync(CartItemRemoved evt) { var cartProjection = await Repository.RetrieveAsync <CartProjection>(evt.AggregateId.ToString()); var cartItem = cartProjection.Products.First(x => x.Sku == evt.Sku); cartProjection.Products.Remove(cartItem); cartProjection.CartTotal = CalculateCartTotal(cartProjection); await Repository.UpsertAsync(cartProjection, evt); }
private void OnCartItemRemoved(CartItemRemoved evt) { var cartItem = _cartItems.First(x => x.Sku == evt.Sku); _cartItems.Remove(cartItem); }