// *3* specific command is handeled public void When(CreateDraftRecipe c) { // validating invariants // ... // from now on things cannot be undone any more! Apply(new DraftRecipeCreated { Id = c.Id, Title = c.Title, CookingInstructions = c.CookingInstructions }); }
private void OnSave() { if (!Validate()) return; var tempId = Guid.NewGuid(); var command = new CreateDraftRecipe { Id = new RecipeId(tempId), Title = State.Title, CookingInstructions = State.Instructions }; Bus.Send(command, () => { State.RecipeId = tempId; State.RecipeStatus = RecipeStatus.Draft; View.Close(); continuation(State); }); }
private void OnSave() { if (!Validate()) { return; } var tempId = Guid.NewGuid(); var command = new CreateDraftRecipe { Id = new RecipeId(tempId), Title = State.Title, CookingInstructions = State.Instructions }; Bus.Send(command, () => { State.RecipeId = tempId; State.RecipeStatus = RecipeStatus.Draft; View.Close(); continuation(State); }); }