private async void BtnSave_Click(object sender, RoutedEventArgs e) { if (TrueOption.SelectedIndex == 0 || QuestionLevel.SelectedIndex == 0 || string.IsNullOrEmpty(txtQuestion.Text) || string.IsNullOrEmpty(OptionA.Text) || string.IsNullOrEmpty(OptipnB.Text) || string.IsNullOrEmpty(OptipnC.Text) || string.IsNullOrEmpty(OptipnD.Text) || string.IsNullOrEmpty(QuestionCategory.Text)) { var msg = new MessageDialog("Eksik Veri Girişi Yaptınız."); await msg.ShowAsync(); } else { await client.AddQuestionAsync(new Question { CategoryID = Convert.ToInt32(QuestionCategory.SelectedIndex + 1), DodID = Convert.ToInt32(QuestionLevel.SelectedIndex + 1), QuestionName = txtQuestion.Text, }); var get = new ObservableCollection <Question>(); get = client._GetQuestionsAsync().Result; var queoptions = new ObservableCollection <QuestionOption>(); //queoptions = client.().Result; foreach (var item in get) { await client.AddQuestionViewAsync(new QuestionViewModel { DodID = item.DodID, QuestionID = item.QuestionID, QuestionName = item.QuestionName }); } for (int i = 1; i < 4; i++) { //if (TrueOption.SelectedItem=="A") //{ // var quest = client._GetQuestionsAsync().Result.Where(x => x.QuestionName == txtQuestion.Text && x.DodID == Convert.ToInt32 (QuestionLevel.SelectedIndex + 1 ) && x.CategoryID= Convert.ToInt32(QuestionCategory.SelectedIndex + 1))); // client.AddQuestionOptionAsync(new QuestionOption { OptionID = i, AnswerStatus = true, AnswerText = OptionA.Text, QuestionID = s}); //} } var ms = new MessageDialog("Kayıt İşlemeniz Başarıyla Gerçekleşti."); await ms.ShowAsync(); } }