public Cart(CartCreatedEvent cartCreatedEvent)
        {
            if (cartCreatedEvent == null)
            {
                throw new ArgumentNullException(nameof(cartCreatedEvent));
            }

            Version = 1;
            UserId  = cartCreatedEvent.UserId;
        }
            public async Task <Cart> Handle(Query query, CancellationToken cancellationToken)
            {
                var cart = await cartsRepository.GetByUserId(query.UserId);

                if (cart == null)
                {
                    var cartCreatedEvent = new CartCreatedEvent(query.UserId);

                    cart = new Cart(cartCreatedEvent);
                }

                throw new Exception();
            }
Exemple #3
0
 private void Handle(CartCreatedEvent evnt)
 {
     _userId = evnt.UserId;
     _cartGoodses = new List<CartGoods>();
 }
Exemple #4
0
 internal void Apply(CartCreatedEvent ev)
 {
     Id         = ev.AggregateId;
     CustomerId = ev.CustomerId;
 }