Beispiel #1
0
        public IEnumerable <AnswerDTO> GetAll()
        {
            List <AnswerDTO> list = new List <AnswerDTO>();

            foreach (var i in unitOfWork.Answers.GetAll().ToList())
            {
                list.Add(mapper.AnswerToAnswerDTO(i));
            }

            return(list);
        }
Beispiel #2
0
        public QuestionDTO QuestionToQuestionDTO(Question question)
        {
            QuestionDTO questionDTO = new QuestionDTO();

            questionDTO.id           = question.id;
            questionDTO.QuestionText = question.QuestionText;
            questionDTO.Category     = question.Category;
            questionDTO.Answers      = new AnswerDTO[question.Answers.Length];
            AnswerMapper mapper = new AnswerMapper();

            for (int i = 0; i < question.Answers.Length; i++)
            {
                questionDTO.Answers[i] = mapper.AnswerToAnswerDTO(question.Answers[i]);
            }

            return(questionDTO);
        }