public async void DeleteButton() { int PK = ResponseButton.CustomID; IOTButton toDelete = await App.IOTDatabase.GetItemAsync(PK); await App.IOTDatabase.DeleteItemAsync(toDelete); ButtonCreationViewModel.InvokeUpdate(); Application.Current.MainPage.Navigation.PopAsync(); }
/// <summary> /// Save IOTButton object to the database /// </summary> /// <param name="item"></param> /// <returns></returns> public Task <int> SaveItemAsync(IOTButton item) { if (item.ID != 0) { return(Database.UpdateAsync(item)); } else { return(Database.InsertAsync(item)); } }
public ButtonCreationViewModel() { Title = "Create button"; Button = new IOTButton(); ClickCommand = new Command(Save); }
/// <summary> /// Delete IOTButton item from database /// </summary> /// <param name="item"></param> /// <returns>Boolean based on success</returns> public Task <int> DeleteItemAsync(IOTButton item) { return(Database.DeleteAsync(item)); }