/// <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); }
/// <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); }
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()); }
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); }