Skip to content

Instantly share code, notes, and snippets.

@susairajs
Created February 7, 2019 14:08
//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