private void CreateTestButton_Click(object sender, RoutedEventArgs e) { if (questionTypeId != -1) { if (QuestionText.Text != "" && AnswerOptions.Text != "" && CorrectAnswer.Text != "" && QuestionCountScores.Text != "") { double num2; bool isDoubleNum = double.TryParse(QuestionCountScores.Text, out num2); if (isDoubleNum == true && double.Parse(QuestionCountScores.Text) > 0) { QueDTOQuestionstion dTOQuestionstion = new QueDTOQuestionstion() { QuestionText = QuestionText.Text, AnswerOption = AnswerOptions.Text, QuestionAnswer = CorrectAnswer.Text, QuestionCountScores = double.Parse(QuestionCountScores.Text), QuestionTypeId = questionTypeId }; int newId = client.SaveQuestion(dTOQuestionstion); string answer = client.AddQuestionIdInTest(testId, newId); if (answer == "succesfull") { main.Content = new AdminTestQuestions(client, mw, main, testId); } else { MessageBox.Show("Some is bad!!!"); } } else { MessageBox.Show("CountScores must be a numbe!!!"); } } else { MessageBox.Show("Please fill in all fields!!!"); } } else { MessageBox.Show("Please chose question type"); } }