private async void Button_Clicked(object sender, EventArgs e) { var transactionCore = new TransactionCore(); if (type.SelectedItem != null && status.SelectedItem != null && amount.Text != null && subCat.SelectedItem != null && from.Text != null && date.Date != null) { int typeId = types.Where(t => t.Key == type.SelectedItem.ToString()).FirstOrDefault().Value; int statusId = statuses.Where(t => t.Key == status.SelectedItem.ToString()).FirstOrDefault().Value; int subCatId = subCats.Where(t => t.Key == subCat.SelectedItem.ToString()).FirstOrDefault().Value; int result = await transactionCore.CreateTransaction(des.Text, from.Text, float.Parse(amount.Text), date.Date.ToString(), accountId, typeId, statusId, subCatId); if (result != -1) { await DisplayAlert("Failed", "Account not added", "OK"); } else { await DisplayAlert("Success", "Account has been added", "OK"); await Navigation.PopAsync(); } } else { await DisplayAlert("Failed", "Account not added", "OK"); } }