/// <summary> /// Handles the CreateAccountName command /// </summary> /// <param name="command">The CreateAccountNameCommand</param> /// <param name="aggregateUnitOfWork">The event transaction</param> public void Handle(CreateAccountCommand command, IAggregateUnitOfWork aggregateUnitOfWork) { Aggregates.Account account = new Aggregates.Account(command.Id, command.Name); this.repository.Save(account, aggregateUnitOfWork); }
/// <summary> /// Handles the ChangeAccountName command /// </summary> /// <param name="command">The ChangeAccountNameCommand</param> /// <param name="aggregateUnitOfWork">The event transaction</param> public void Handle(ChangeAccountNameCommand command, IAggregateUnitOfWork aggregateUnitOfWork) { Aggregates.Account account = this.repository.Find(command.Id, aggregateUnitOfWork); account.ChangeName(command.Name); this.repository.Save(account, aggregateUnitOfWork); }