Beispiel #1
0
        public async Task InsertBookItemAsync(BookItem bookItem)
        {
            try
            {
                await bookTable.InsertAsync(bookItem); // Insert a new BookItem into the local database.
                await SyncAsync();                     // send changes to the mobile service

                Items.Add(bookItem);
            }
            catch (MobileServiceInvalidOperationException e)
            {
                Console.Error.WriteLine(@"ERROR {0}", e.Message);
            }
        }
Beispiel #2
0
        public async Task CompleteItemAsync(BookItem item)
        {
            try
            {
                item.Complete = true;
                await bookTable.UpdateAsync(item); // update book item in the local database
                await SyncAsync();                 // send changes to the mobile service

                Items.Remove(item);
            }
            catch (MobileServiceInvalidOperationException e)
            {
                Console.Error.WriteLine(@"ERROR {0}", e.Message);
            }
        }