Beispiel #1
0
        private void SaveChanges()
        {
            var id           = _newQuestion ? Guid.NewGuid().ToString("N") : _question.Id;
            var text         = lblQuestion.Text;
            var rightAnswer  = lblCorrectAnswer.Text;
            var wrongAnswer1 = lblWrongAnswer1.Text;
            var wrongAnswer2 = lblWrongAnswer2.Text;
            var wrongAnswer3 = lblWrongAnswer3.Text;
            var difficulty   = GetDifficulty();

            var question = new QuestionDto(id, text, difficulty, wrongAnswer1, wrongAnswer2, wrongAnswer3, rightAnswer);

            if (_newQuestion)
            {
                Db.AddQuestionToCourse(question, _course);
            }
            else
            {
                Db.EditQuestion(question);
            }

            Close();
        }