samples/TodoApp/TodoApp.Data/Services/RemoteTodoService.cs
/// <summary>
/// Saves an item to the list.  If the item does not have an Id, then the item
/// is considered new and will be added to the end of the list.  Otherwise, the
/// item is considered existing and is replaced.
/// </summary>
/// <param name="item">The new item</param>
/// <returns>A task that completes when the item is saved.</returns>
Saves an item to the list.  If the item does not have an Id, then the item
is considered new and will be added to the end of the list.  Otherwise, the
item is considered existing and is replaced.
Saves an item to the list . If the item does not have an Id then the item is considered new and will be added to the end of the list . Otherwise the item is considered existing and is replaced .
public async Task SaveItemAsync(TodoItem item)
        {
            if (item == null)
            {
                throw new ArgumentException(nameof(item));
            }
            await InitializeAsync();
            TodoServiceEventArgs.ListAction action = (item.Id == null) ? TodoServiceEventArgs.ListAction.Add : TodoServiceEventArgs.ListAction.Update;
            if (item.Id == null)
            {
                await _table.InsertItemAsync(item);
            }
            else
            {
                await _table.ReplaceItemAsync(item);
            }
            TodoItemsUpdated?.Invoke(this, new TodoServiceEventArgs(action, item));
        }
public async Task SaveItemAsync ( TodoItem item ) { if ( item == null ) { throw new ArgumentException ( nameof ( item ) ) ; } await InitializeAsync ( ) ; TodoServiceEventArgs . ListAction action = ( item . Id == null ) ? TodoServiceEventArgs . ListAction . Add : TodoServiceEventArgs . ListAction . Update ; if ( item . Id == null ) { await _table . InsertItemAsync ( item ) ; } else { await _table . ReplaceItemAsync ( item ) ; } TodoItemsUpdated ? . Invoke ( this , new TodoServiceEventArgs ( action , item ) ) ; }
Saves an item to the list.
Saves an item to the list .
A task that completes when the item is saved.
A task that completes when the item is saved .
item
TodoItem
The new item
The new item