private async void BtnClear_Clicked(object sender, EventArgs e) { bool clear = await DisplayAlert("Warning", "Want to clear all?", "Yes", "No"); if (clear) { MoneyManageDB database = MoneyManageDB.Database; bool result = database.DeleteAllAsync(); if (result) { DisplayAlert("Success", "", "ok"); App.Current.Quit(); } else { DisplayAlert("Failed", "Try after sometime", "ok"); } } }
private void BtnSave_Clicked(object sender, EventArgs e) { if (FieldsValid()) { MoneyManageDB database = MoneyManageDB.Database; Person person = new Person() { personName = this.personName.Text.Trim(), mobileNo = this.mobileNo.Text?.Trim(), email = this.email.Text?.Trim(), address = this.adress.Text?.Trim(), createdDate = DateTime.Now }; int a = database.SaveAsync(person).Result; int b = database.GetPersonsAsync().Result.Count(); DisplayAlert("Success! count " + b.ToString(), a.ToString(), "ok"); ClearFields(); } }