Beispiel #1
0
 public void Handle(AddedNewToDoItemEvent @event)
 {
     using (var db = new ToDoContext())
     {
         int      listId = _identityMapper.GetModelId <ToDoList>(@event.ToDoListId);
         ToDoList list   = db.Lists.First(t => t.Id.Equals(listId));
         if (list != null)
         {
             var _item = new Model.ToDoItem()
             {
                 //Id = @event.ToDoItemId,
                 ToDoListId   = listId,
                 Description  = @event.Description,
                 CreationDate = @event.CreationDate,
                 DueDate      = @event.DueDate,
                 Importance   = @event.Importance,
                 ClosingDate  = null,
                 UserId       = 0
             };
             list.Items.Add(_item);
             db.SaveChanges();
             _identityMapper.Map <ToDoItem>(_item.Id, @event.ToDoItemId);
         }
     }
 }
Beispiel #2
0
 void Apply(AddedNewToDoItemEvent @event)
 {
     Id           = @event.ToDoItemId;
     ToDoListId   = @event.ToDoListId;
     Description  = @event.Description;
     CreationDate = @event.CreationDate;
     DueDate      = @event.DueDate;
     Importance   = @event.Importance;
     ClosingDate  = null;
 }
Beispiel #3
0
 void Apply(AddedNewToDoItemEvent @event)
 {
     Id = @event.ToDoItemId;
     ToDoListId = @event.ToDoListId;
     Description = @event.Description;
     CreationDate = @event.CreationDate;
     DueDate = @event.DueDate;
     Importance = @event.Importance;
     ClosingDate = null;
 }