private void Deleted(TodoItemViewModel vm, Todo todo) { var existing = TodoList.FirstOrDefault(x => x.Id == todo.Id); if (existing != null) { TodoList.Remove(existing); } }
private void Changed(TodoItemViewModel vm, Todo todo) { var existing = TodoList.FirstOrDefault(x => x.Id == todo.Id); if (existing == null) //new { TodoList.Add(todo); } else //changed { TodoList[TodoList.IndexOf(existing)] = todo; } }