/// <summary> /// Replaces the item identified by the whereClause /// </summary> /// <param name="items">The items to modify</param> /// <param name="whereClause">The predicate to use</param> /// <param name="item">The new item</param> /// <returns>True if an item was updated</returns> public static bool ReplaceIf(this ObservableCollection <TodoItem> items, Func <TodoItem, bool> whereClause, TodoItem item) { var index = items.IndexOf(whereClause); if (index >= 0) { items[index] = item; return(true); } return(false); }
public TodoListEventArgs(TodoListAction action, TodoItem item) { Action = action; Item = item; }
private void OnTodoListChanged(TodoListAction action, TodoItem item) => TodoListUpdated?.Invoke(this, new TodoListEventArgs(action, item));
/// <summary> /// Saves an item to the table, calling either update or add, depending on if it exists. /// </summary> /// <param name="item">The item to be saved</param> public Task SaveTodoItemAsync(TodoItem item) => (item.Id == null) ? AddTodoItemAsync(item) : UpdateTodoItemAsync(item);