public void Handle(ChangedToDoItemImportanceEvent @event) { using (var db = new ToDoContext()) { int itemId = _identityMapper.GetModelId <ToDoItem>(@event.Id); ToDoItem item = db.Items.First(t => t.Id.Equals(itemId)); if (item != null) { item.Importance = @event.Importance; db.Entry(item).State = EntityState.Modified; db.SaveChanges(); } } }
void Apply(ChangedToDoItemImportanceEvent @event) { Importance = @event.Importance; }