Exemple #1
0
        public async Task <bool> Handle(QuestionAnsweredEvent request, CancellationToken cancellationToken)
        {
            SurveyResponse surveyResponse = await _surveyResponseUnitOfWork.GetOrCreate(
                new { request.QuestionnareId, request.ExecutionId },
                () => SurveyResponse.Create(request.ExecutionId, request.QuestionnareId));

            QuestionResponse response = QuestionResponse.Create(request.Subject,
                                                                request.Question,
                                                                request.Answers,
                                                                request.Answer,
                                                                request.AnswerIndex);

            surveyResponse.AddResponse(response);

            await _surveyResponseUnitOfWork.Commit();

            return(true);
        }