public async System.Threading.Tasks.Task Handle(DueDateRemovedFromTaskEvent message) { var t = ActiveDbContext.Tasks.Find(message.TaskId); t.DueDate = null; await ActiveDbContext.SaveChangesAsync(); }
public void RemoveDueDate() { if (this.DateOfCompletion.HasValue) { throw new InvalidOperationException("Can't remove due date for a completed task"); } if (this.DateOfCancellation.HasValue) { throw new InvalidOperationException("Can't remove due date for a cancelled task"); } if (!this.DueDate.HasValue) { throw new InvalidOperationException("Can't remove due date for a task that already doesn't have any due date"); } var e = new DueDateRemovedFromTaskEvent { TaskId = this.Id }; RaiseEvent(e); }
public void ApplyEvent(DueDateRemovedFromTaskEvent @event) { this.DueDate = null; }