Example #1
0
 public EventRegistrationCommand(
     string name,
     string shortDescription,
     string longDescription,
     DateTime startDate,
     DateTime endDate,
     bool isFree,
     decimal price,
     bool online,
     string companyName,
     Guid organizerId,
     Guid categoryId,
     AddAddressEventCommand address)
 {
     Id               = Guid.NewGuid();
     AggregateId      = Id;
     Name             = name;
     ShortDescription = shortDescription;
     LongDescription  = longDescription;
     StartDate        = startDate;
     EndDate          = endDate;
     IsFree           = isFree;
     Price            = price;
     Online           = online;
     CompanyName      = companyName;
     OrganizerId      = organizerId;
     CategoryId       = categoryId;
     Address          = address;
 }
Example #2
0
        public void Handle(AddAddressEventCommand message)
        {
            var address = new Address(message.Id, message.Address1, message.Address2, message.ZipCode, message.City, message.Province, message.EventId.Value);

            if (!address.IsValid())
            {
                NotifyValidationError(address.ValidationResult);
                return;
            }

            _eventRepository.AddAddress(address);

            if (Commit())
            {
                _bus.RaiseEvent(new AddressEventAddedEvent(address.Id, address.Address1, address.Address2, address.ZipCode, address.City, address.Province, address.EventId.Value));
            }
        }