Esempio n. 1
0
        public async System.Threading.Tasks.Task Handle(DueDateSetForTaskEvent message)
        {
            var t = ActiveDbContext.Tasks.Find(message.TaskId);

            t.DueDate = message.DueDate;
            await ActiveDbContext.SaveChangesAsync();
        }
Esempio n. 2
0
        public void SetDueDate(DateTime dueDate)
        {
            if (this.DateOfCompletion.HasValue)
            {
                throw new InvalidOperationException("Can't set a due date for a completed task");
            }
            if (this.DateOfCancellation.HasValue)
            {
                throw new InvalidOperationException("Can't set a due date for a cancelled task");
            }
            if (dueDate < this.DateOfCreation)
            {
                throw new ArgumentException("The due date should be set later than the creation date.", nameof(dueDate));
            }
            var e = new DueDateSetForTaskEvent()
            {
                DueDate = dueDate,
                TaskId  = this.Id
            };

            RaiseEvent(e);
        }
Esempio n. 3
0
 public void ApplyEvent(DueDateSetForTaskEvent @event)
 {
     this.DueDate = @event.DueDate;
 }