Ejemplo n.º 1
0
        //public static List<Comment> Convert(List<CommentDTO> commentsDTO)
        //{
        //    List<Comment> comments = new List<Comment>();
        //    commentsDTO.ForEach(c => comments.Add(Convert(c)));
        //    return comments;
        //}
        //public static List<CommentDTO> Convert(List<Comment> comments)
        //{
        //    List<CommentDTO> commentsDTO = new List<CommentDTO>();
        //    comments.ForEach(a => commentsDTO.Add(Convert(a)));
        //    return commentsDTO;
        //}
        public static QuestionDTO Convert(Question question)
        {
            QuestionDTO questionDTO = new QuestionDTO()
            {
                Answers         = question.Answers?.Select(a => Convert(a)).ToList(),
                QuestionDate    = question.questionDate,
                QuestionId      = question.questionId,
                QuestionTitle   = question.questionTitle,
                Question_userId = question.question_userId,
                Requirement     = question.requirement,
                //User = question.User,
                Votes = question.Votes?.Select(v => Convert(v)).ToList()
            };

            questionDTO.Items = ConverterHelpers.GetQuestionItems(question.fileName);
            return(questionDTO);
        }
Ejemplo n.º 2
0
 public static Question Convert(QuestionDTO question)
 {
     return(new Question()
     {
         Answers = question.Answers?.Select(a => Convert(a)).ToList(),
         fileName = ConverterHelpers.SaveQuestionItems(question.Items),
         questionDate = question.QuestionDate,
         questionId = question.QuestionId,
         questionTitle = question.QuestionTitle,
         question_userId = question.Question_userId,
         requirement = question.Requirement,
         Category_Question = question.Categories?.Select(c => new Category_Question {
             categoryId = c.CategoryId, questionId = question.QuestionId
         }).ToList(),
         //User = question.User,
         Votes = question.Votes?.Select(v => Convert(v)).ToList()
     });
 }
Ejemplo n.º 3
0
        public override DTOBase PopulateDTO(SqlDataReader reader)
        {
            QuestionDTO theTDO = new QuestionDTO();

            // Id
            if (!reader.IsDBNull(ord_Id))
            {
                theTDO.Id = reader.GetInt32(ord_Id);
            }
            // IdTheme
            if (!reader.IsDBNull(ord_IdTheme))
            {
                theTDO.IdTheme = reader.GetString(ord_IdTheme);
            }
            // Libelle
            if (!reader.IsDBNull(ord_Libelle))
            {
                theTDO.Libelle = reader.GetString(ord_Libelle);
            }
            // IsNew
            theTDO.IsNew = false;
            return(theTDO);
        }