Beispiel #1
0
 public RegisterConferenceCommand(
     Guid id,
     string name,
     string shortDescription,
     string longDescription,
     DateTime startDate,
     DateTime endDate,
     bool free,
     decimal value,
     bool online,
     string companyName,
     Guid organizerId,
     Guid categoryId,
     AddAddressConferenceCommand address)
 {
     Id               = id;
     Name             = name;
     ShortDescription = shortDescription;
     LongDescription  = longDescription;
     StartDate        = startDate;
     EndDate          = endDate;
     Free             = free;
     Value            = value;
     Online           = online;
     CompanyName      = companyName;
     OrganizerId      = organizerId;
     CategoryId       = categoryId;
     Address          = address;
 }
Beispiel #2
0
        public Task <Unit> Handle(AddAddressConferenceCommand message, CancellationToken cancellationToken)
        {
            var address = new Address(message.Id, message.Address1, message.Address2, message.Address3,
                                      message.Number, message.Postcode, message.City, message.County, message.ConferenceId.Value);

            if (!address.IsValid())
            {
                NotifyValidationError(address.ValidationResult);
                return(Task.FromResult(Unit.Value));
            }

            var conference = _conferenceRepository.GetById(address.ConferenceId.Value);

            conference.SwitchToPresencial();

            _conferenceRepository.Update(conference);
            _conferenceRepository.AddAddress(address);

            if (Commit())
            {
                _mediator.PublishEvent(new AddressConferenceAddedEvent(address.Id, address.Address1, address.Address2, address.Address3,
                                                                       address.Number, address.Postcode, address.City, address.County, address.ConferenceId.Value));
            }

            return(Task.FromResult(Unit.Value));
        }