public override async Task ExecuteAsync(OrderAggregate aggregate, AddProductToOrderCommand command, CancellationToken cancellationToken)
 {
     var stateMachine = new OrderStateMachine();
     await stateMachine.RaiseEvent(aggregate, stateMachine.AddProductToOrderRequested,
                                   new AddProductToOrderData(command.Name, command.Count, command.Price), cancellationToken);
 }
 public override async Task ExecuteAsync(OrderAggregate aggregate, CancelOrderPaymentCommand command, CancellationToken cancellationToken)
 {
     var stateMachine = new OrderStateMachine();
     await stateMachine.RaiseEvent(aggregate, stateMachine.PaymentProcessCanceled, cancellationToken);
 }
 public override async Task ExecuteAsync(OrderAggregate aggregate, MarkPaymentProcessAsStartedCommand command,
                                         CancellationToken cancellationToken)
 {
     var stateMachine = new OrderStateMachine();
     await stateMachine.RaiseEvent(aggregate, stateMachine.PaymentProcessSuccessfullyRequested, command.PaymentId, cancellationToken);
 }
 public override async Task ExecuteAsync(OrderAggregate aggregate, CreateOrderCommand command, CancellationToken cancellationToken)
 {
     var stateMachine = new OrderStateMachine();
     await stateMachine.RaiseEvent(aggregate, stateMachine.OrderCreationRequested, command.Username, cancellationToken);
 }
 public override async Task ExecuteAsync(OrderAggregate aggregate, CompleteOrderCommand command, CancellationToken cancellationToken)
 {
     var stateMachine = new OrderStateMachine();
     await stateMachine.RaiseEvent(aggregate, stateMachine.PaymentProcessSuccessfullyFinished, cancellationToken);
 }