예제 #1
0
        private void Deleted(TodoItemViewModel vm, Todo todo)
        {
            var existing = TodoList.FirstOrDefault(x => x.Id == todo.Id);

            if (existing != null)
            {
                TodoList.Remove(existing);
            }
        }
예제 #2
0
        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;
            }
        }