コード例 #1
0
        public async Task <Unit> Handle(AddCompanyCommand command, CancellationToken cancellationToken)
        {
            var contact = await _aggregateRepository.Load(command.ContactId);

            contact.AddCompany(command.CompanyId, command.CompanyName, command.CreatedDate);

            await _aggregateRepository.Save(contact);

            return(Unit.Value);
        }
コード例 #2
0
        public async Task <Unit> Handle(CreateContactCommand command, CancellationToken cancellationToken)
        {
            var contact = await _aggregateRepository.Load(command.ContactId);

            contact.CreateContact(command.ContactId, command.UserId, command.FirstName, command.LastName, command.DateOfBirth, command.Nationality, command.EmailAddress, command.Country);

            contact.SetAddress(command.ContactId, command.HouseNumber, command.Street, command.Locality,
                               command.City, command.County, command.Postcode, command.Country);

            await _aggregateRepository.Save(contact);

            return(Unit.Value);
        }