Skip to content

Instantly share code, notes, and snippets.

@susairajs
Created January 19, 2020 14:09
public async Task UpdatePerson(int personId, string name)
{
var toUpdatePerson = (await firebase
.Child("Persons")
.OnceAsync<Person>()).Where(a => a.Object.PersonId == personId).FirstOrDefault();
await firebase
.Child("Persons")
.Child(toUpdatePerson.Key)
.PutAsync(new Person() { PersonId = personId, Name = name });
}
private async void BtnUpdate_Clicked(object sender, EventArgs e)
{
await firebaseHelper.UpdatePerson(Convert.ToInt32(txtId.Text), txtName.Text);
txtId.Text = string.Empty;
txtName.Text = string.Empty;
await DisplayAlert("Success", "Person Updated Successfully", "OK");
var allPersons = await firebaseHelper.GetAllPersons();
lstPersons.ItemsSource = allPersons;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment