async void Button_Clicked(object sender, EventArgs e) { await _connection.CreateTableAsync <FavorietLijst>(); try { var AddFav = new FavorietLijst { Id = dogId }; // add the currentdog.Id to favoritelist.Id await _connection.InsertAsync(AddFav); // insert into the table in the database FavCheck(dogId); } catch { await DisplayAlert("Notificatie", "Deze hond staat al in uw favorietenlijst", "Oké");// if currentId is in dogId => displayalert } }
async void RemoveButton_Clicked(object sender, EventArgs e) { int dogId = currentdog.Id; // turn the currentdog.Id into and integer await _connection.CreateTableAsync <FavorietLijst>(); try { var DelFav = new FavorietLijst { Id = dogId }; // select the current dog from favorite list await _connection.DeleteAsync(DelFav); // delete the current dog from favorite list FavCheck(dogId); } catch { await DisplayAlert("Notificatie", "Deze hond staat niet in uw favorietenlijst. Je kan deze hond niet uit je favorietenlijst verweideren", "Oké");// if currentId is in dogId => displayalert } }