public static QuestionImageDtoBO ToDto(this Models.Question entity)
 {
     return(new QuestionImageDtoBO
     {
         Id = entity.Id,
         Interogation = entity.Interogation,
         Reponse = entity.Propositions == null ? null : (PropositionDtoBOExtensions.ToDto(entity.Propositions.First(x => x.IsCorrect))).ToReponse(),
         MediaQuestions = entity.MediaQuestions.Select(x => x.ToDto()).ToList(),
         QuestionType = entity.QuestionType
     });
 }
Exemple #2
0
 public static QuestionTexteDtoBO ToDto(this Models.Question entity)
 {
     return(new QuestionTexteDtoBO
     {
         Id = entity.Id,
         Interogation = entity.Interogation,
         Reponse = entity.Propositions == null ? null : (PropositionDtoBOExtensions.ToDto(entity.Propositions.First(x => x.IsCorrect))).ToReponse(),
         Propositions = entity.Propositions.Where(x => !x.IsCorrect).Select(x => PropositionDtoBOExtensions.ToDto(x)).ToList(),
         QuestionType = entity.QuestionType,
         Media = entity.MediaQuestions.Count == 0 ? null : entity.MediaQuestions.First().ToDto()
     });
 }