public Person Take(CreditCardDeactivateCommand command) { var creditCard = CreditCards.First(c => c.Id == command.CreditCardId); creditCard.Take(command); base.AddEvent(new PersonCreditCardUpdateDomainEvent { AggregateRootId = Id, CommandJson = JsonConvert.SerializeObject(command), UserId = command.UserId }); return(this); }
public async Task <ICommandHandlerAggregateAnswer> HandleAsync(CreditCardDeactivateCommand command) { var answer = new CommandHandlerAggregateAnswer(); var person = await personRepository.Query(command.PersonId); if (person.IsNotNull()) { answer.ValidationResult = this.deactivateCreditCardValidationHandler.Validate(command); if (command.IsValid) { answer.AggregateRoot = await personRepository.Update(person.Take(command)); } } return(answer); }
public void Take(CreditCardDeactivateCommand command) { this.CopyPropertiesFrom(command); }