Пример #1
0
        private async Task AddChoiceOptionsAnswerAsync(int surveyId, FieldDataAnswerToAdd fieldDataAnswer,
                                                       string select, int fieldDataAnswerId, QuestionAnswerToAdd questionAnswer)
        {
            if (questionAnswer.Select == "single-choice" || questionAnswer.Select == "multiple-choice" ||
                questionAnswer.Select == "dropdown-menu" || questionAnswer.Select == "linear-scale")
            {
                var counter = 0;
                foreach (var choiceOption in fieldDataAnswer.ChoiceOptions)
                {
                    await AddChoiceOptionsAnswerToFieldDataAnswerAsync(surveyId, fieldDataAnswerId,
                                                                       counter,
                                                                       choiceOption.Value, choiceOption.ViewValue);

                    counter++;
                }
            }
        }
Пример #2
0
        private async Task AddRowsAnswerAsync(int surveyId, FieldDataAnswerToAdd fieldDataAnswer,
                                              string select, QuestionAnswerToAdd questionAnswer, int fieldDataAnswerId)
        {
            if (fieldDataAnswer.Rows != null)
            {
                foreach (var rowAnswer in fieldDataAnswer.Rows)
                {
                    var rowAnswerId = await AddRowAnswerAsync(fieldDataAnswerId,
                                                              rowAnswer.RowPosition, rowAnswer.Input);

                    if (rowAnswer.ChoiceOptions != null)
                    {
                        await AddChoiceOptionAnswerToRow(surveyId, rowAnswer, rowAnswerId);
                    }
                }
            }
        }