async void AddOrUpdateCommandAction() { if (!string.IsNullOrEmpty(Question.Description) && !string.IsNullOrEmpty(AnswerList[0].Description) && !string.IsNullOrEmpty(AnswerList[1].Description) && !string.IsNullOrEmpty(AnswerList[1].Description)) { //Question.QuestionID = 0; if (AnswerList[0].QuestionFK != Question.QuestionID) { Question.QuestionID = AnswerList[0].QuestionFK; await _dialogService.DisplayAlertAsync("Error", "You can not change the ID, please select concerned Question or create new question !", "OK"); return; } //Add New Question App.SQLiteDb.SaveItemAsync(Question); //Add all Answers of questions in Answer Table for (int i = 0; i < 3; i++) { App.SQLiteDb.SaveItemAsync(AnswerList[i]); } //fill all answer in question --> quesion id as changed after that Question.Answers = AnswerList.ToList(); //finally update Question App.SQLiteDb.SaveItemAsync(Question); //nooooooooooon il faut utilser SQLiteNetExtensions packet nugget //foreach (var answer in AnswerList) // await App.SQLiteDb.SaveItemAsync(answer); await _dialogService.DisplayAlertAsync("Sucess", "Question saved !", "OK"); GetAllQuestion(); InitializeQuestion(); } else { await _dialogService.DisplayAlertAsync("Error", "Question not saved ! You forgot something", "OK"); } }