Пример #1
0
        /// <summary>
        ///     To the azure model.
        /// </summary>
        /// <param name="question">The question.</param>
        /// <returns>QuestionAzure.</returns>
        public static QuestionAzure ToAzureModel(this Question question)
        {
            var azureModel = new QuestionAzure();

            question.CopyTo(azureModel);
            return(azureModel);
        }
Пример #2
0
        /// <summary>
        ///     To the azure model.
        /// </summary>
        /// <param name="azureModel">The azure model.</param>
        /// <returns>Question.</returns>
        public static Question FromAzureModel(this QuestionAzure azureModel)
        {
            var question = new Question();

            azureModel.CopyTo(question);
            return(question);
        }
Пример #3
0
        private List <QuestionAzure> GeneratePersonQualityLinks(QuestionOption option, string questionId)
        {
            if (option.PersonQualitiesWithScores == null)
            {
                return(new List <QuestionAzure>());
            }

            return
                (option.PersonQualitiesWithScores.Where(
                     t =>
                     !string.IsNullOrEmpty(t.PersonQualityId))
                 .Select(
                     t =>
                     QuestionAzure.CreateLinkToPersonQuality(
                         questionId,
                         option.Number,
                         t.PersonQualityId,
                         t.Score))
                 .ToList());
        }
Пример #4
0
        private List <QuestionAzure> GenerateOptions(Question question)
        {
            var result = new List <QuestionAzure>();

            if (question.Options != null)
            {
                foreach (var questionOption in question.Options)
                {
                    var optionLink = QuestionAzure.CreateOption(questionOption, question.Id);
                    result.Add(optionLink);
                    var personQualityLinks = GeneratePersonQualityLinks(questionOption, question.Id);
                    if (personQualityLinks.Any())
                    {
                        result.AddRange(personQualityLinks);
                    }
                }
            }

            return(result);
        }