public async Task HandleAsync(TodoItemMarkedAsUnComplete @event) { var todoItem = await this._unitOfWork.Repository <TodoItem>().GetByIdAsync(@event.SourceId); todoItem.IsComplete = false; todoItem.Version = @event.Version; this._unitOfWork.Repository <TodoItem>().Update(todoItem); await this._unitOfWork.SaveChangesAsync(); }
public void MarkTodoItemAsUnComplete() { if (!this.IsComplete) { throw new DomainValidationException("Todo item is already marked as uncomplete"); } var @event = new TodoItemMarkedAsUnComplete(); ApplyEvent(@event); }
public async Task HandleAsync(TodoItemMarkedAsUnComplete @event) { await Task.Delay(500); }
public void When(TodoItemMarkedAsUnComplete @event) { this.IsComplete = false; }