コード例 #1
0
        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);
        }
コード例 #2
0
        private void OnCartItemRemoved(CartItemRemoved evt)
        {
            var cartItem = _cartItems.First(x => x.Sku == evt.Sku);

            _cartItems.Remove(cartItem);
        }