/// <summary> /// Invoke the command /// </summary> /// <param name="command">Command to run</param> public void Invoke(CreateNote command) { var note = new Note(command.Title, command.Body); _storage.Save(note); DomainEvent.Publish(new NoteCreated(note.Id)); }
/// <summary> /// Invoke the command /// </summary> /// <param name="command">Command to run</param> public void Invoke(CompleteNote command) { var note = _storage.Load(command.Id); note.Complete(); _storage.Save(note); }
/// <summary> /// Invoke the command /// </summary> /// <param name="command">Command to run</param> public void Invoke(UpdateNote command) { var note = _storage.Load(command.Id); note.Update(command.NewBody); _storage.Save(note); }