public void Handle(QuestionUpdated message) { _db.Questions.Update(message.QuestionId, question => { question.Question = message.Question; }); }
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(); }