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); }
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); }