public void DeleteDocument(CompletionHandler handler) { _documentReference.Delete().AddOnCompleteListener(new OnCompleteHandlerListener((task) => { handler?.Invoke(task.IsSuccessful ? null : ExceptionMapper.Map(task.Exception)); })); }
public void onDeleteMethodCallback(string expenseID) { if (!CrossConnectivity.Current.IsConnected) { Toast.MakeText(this, "Please check your internet connection", ToastLength.Long).Show(); return; } Android.Support.V7.App.AlertDialog.Builder alert = new Android.Support.V7.App.AlertDialog.Builder(this); // AlertDialog alert = dialog.Create(); alert.SetTitle("Delete"); alert.SetMessage("Are you sure you wan't to delete this?"); // alert.SetIcon(Resource.Drawable.alert); alert.SetPositiveButton("YES", (c, ev) => { DocumentReference docref = database.Collection("ExpenseTable").Document(expenseID); docref.Delete(); bottomAppBar.TranslationY = 0.0f; fab.TranslationY = -84.0f; FetchExpensesTableForMonthYear(); }); alert.SetNegativeButton("CANCEL", (c, ev) => { }); Dialog dialog = alert.Create(); dialog.Show(); }
private void Cartadapter_DeleteItemClick(object sender, CartAdapterClickEventArgs e) { var key = cartresult[e.Position].ID; Android.Support.V7.App.AlertDialog.Builder deletedataAlert = new Android.Support.V7.App.AlertDialog.Builder(this); deletedataAlert.SetTitle("REMOVE FROM CART?"); deletedataAlert.SetMessage("Are you sure?"); deletedataAlert.SetPositiveButton("Continue", (senderAlert, args) => { //services = new MainActivity(); //FirebaseFirestore database = services.database; //services.deleteUser(userID); DocumentReference docRef = database.Collection("carts").Document(key); docRef.Delete(); deletedataAlert.Dispose(); Toast.MakeText(this, "Product Removed Successfully", ToastLength.Long); }); deletedataAlert.SetNegativeButton("Cancel", (senderAlert, args) => { deletedataAlert.Dispose(); }); deletedataAlert.Show(); //DocumentReference docref = database.Collection("carts").Document(key); //docref.Delete(); }
public void deleteItem(string documnet, string id) { DocumentReference docRef = database.Collection(documnet).Document(id); docRef.Delete(); }
/// <summary> /// deletes a document from a collection /// </summary> /// <param name="cName">the collection name</param> /// <param name="dName">the document name</param> public void DeleteDocumentFromCollection(string cName, string dName) { DocumentReference cr = firestore.Collection(cName).Document(dName); cr.Delete(); }