Created
February 7, 2019 14:08
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Delete | |
public Task<int> DeleteItemAsync(Person person) | |
{ | |
return db.DeleteAsync(person); | |
} | |
private async void BtnDelete_Clicked(object sender, EventArgs e) | |
{ | |
if (!string.IsNullOrEmpty(txtPersonId.Text)) | |
{ | |
//Get Person | |
var person = await App.SQLiteDb.GetItemAsync(Convert.ToInt32(txtPersonId.Text)); | |
if (person != null) | |
{ | |
//Delete Person | |
await App.SQLiteDb.DeleteItemAsync(person); | |
txtPersonId.Text = string.Empty; | |
await DisplayAlert("Success", "Person Deleted", "OK"); | |
//Get All Persons | |
var personList = await App.SQLiteDb.GetItemsAsync(); | |
if (personList != null) | |
{ | |
lstPersons.ItemsSource = personList; | |
} | |
} | |
} | |
else | |
{ | |
await DisplayAlert("Required", "Please Enter PersonID", "OK"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment