Exemple #1
0
        public void Reserve(CustomerId customerId, ICustomerRepository customerRepository)
        {
            if (!customerRepository.Get(customerId).CanReserve())
            {
                throw new DomainEvent("Only VIP Clients can reserve masterpieces");
            }

            if (_reservationCustomerId == customerId)
            {
                throw new DomainEvent("Already reserved by you");
            }

            if (_reservationCustomerId != null && _reservationCustomerId != customerId)
            {
                throw new DomainEvent("Already reserved");
            }

            _reservationCustomerId = customerId;
            PublishEvent(new MasterpieceReservedEvent(Id, customerId, Version));
        }
Exemple #2
0
 public RevokedMasterpieceReservationEvent(Guid id, CustomerId customerId, int version)
 {
     Id         = id;
     CustomerId = customerId;
     Version    = version;
 }
Exemple #3
0
 public MasterpieceBoughtEvent(Guid id, CustomerId customerId, int version)
 {
     Id         = id;
     CustomerId = customerId;
     Version    = version;
 }
Exemple #4
0
 public MasterpieceReservedEvent(Guid id, CustomerId customerId, int version)
 {
     Id         = id;
     CustomerId = customerId;
     Version    = version;
 }