示例#1
0
        public async System.Threading.Tasks.Task Handle(DueDateRemovedFromTaskEvent message)
        {
            var t = ActiveDbContext.Tasks.Find(message.TaskId);

            t.DueDate = null;
            await ActiveDbContext.SaveChangesAsync();
        }
示例#2
0
文件: Task.cs 项目: ymulenll/Merp
        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);
        }
示例#3
0
文件: Task.cs 项目: ymulenll/Merp
 public void ApplyEvent(DueDateRemovedFromTaskEvent @event)
 {
     this.DueDate = null;
 }