private void BtnSave_Clicked(object sender, EventArgs e) { if (string.IsNullOrEmpty(In_Amount.Text)) { Inc.Amount = Convert.ToDouble(In_Amount.Text); Inc.Date = In_Date.Date; Inc.Note = In_Note.Text; Inc.Category = Cat; if (IncomesDatabase.SaveIncome(Inc) != 0) // update income to Database { _incomes.Add(Inc); //add Income to Obseverbale list DisplayAlert("hey", "Expense saved successfully", "great"); } } else { DisplayAlert("hey", "Please enter amount", "Ok"); //shouldn't be run ever! } Clear(); }
private void BtnSave_Clicked(object sender, EventArgs e) { if (!string.IsNullOrEmpty(In_Amount.Text)) { Income income = new Income { Amount = Convert.ToDouble(In_Amount.Text), Category = CatList.SelectedItem.ToString(), Note = In_Note.Text, Date = In_Date.Date }; if (IncomeDabatase.SaveIncome(income) != 0) { _incomes.Add(income); DisplayAlert("hey", "Income saved successfully", "great"); } } else { DisplayAlert("hey", "Please enter the amount", "Ok"); } }