コード例 #1
0
 public void Handle(QuestionUpdated message)
 {
     _db.Questions.Update(message.QuestionId, question =>
     {
         question.Question = message.Question;
     });
 }
コード例 #2
0
        private void OnQuestionTypeChange()
        {
            // Added to prevent a bug, the bind event sometimes will be called again and again
            if (Question.QuestionType == _lastQuestionType)
            {
                return;
            }

            if (_parameterSetState)
            {
                _parameterSetState = false;
                return;
            }

            Console.WriteLine("OnQuestionTypeChange");

            var questionText = Question.Question;
            var questionType = Question.QuestionType;

            if (questionType == "choice")
            {
                Question = new ChoiceQuestion();
                ((ChoiceQuestion)Question).Choices = new List <string>();
            }
            else if (questionType == "short_answer")
            {
                Question = new ShortAnswerQuestion();
            }

            Question.Question     = questionText;
            Question.QuestionType = questionType;
            _lastQuestionType     = questionType;

            QuestionUpdated.InvokeAsync(Question);
            StateHasChanged();
        }