public void When(ListOfInvoiceItemsAddedEvent @event) { switch (State) { case AddInvoiceWithItemsProcessState.InvoiceCreated: var addItemsCommand = GetAddItemsCommand(); AddCommand(addItemsCommand); break; case AddInvoiceWithItemsProcessState.InvoiceItemsAdded: break; default: throw new NotAllowedOperationException(); } }
private void When(ListOfInvoiceItemsAddedEvent @event) { Id = @event.AggregateRootId; Items = @event.InvoiceItems; }