Exemplo n.º 1
0
        public static Quiz_DTO ConvertQuizTo_DTO(Quiz quiz, ref Quiz_DTO quiz_DTO, IQuizRepo quizRepo)
        {
            quiz_DTO.Id           = quiz.Id;
            quiz_DTO.DifficultyId = quiz.DifficultyId;
            quiz_DTO.Subject      = quiz.Subject;
            quiz_DTO.Description  = quiz.Description;

            var diff = new Difficulty_DTO();

            quiz_DTO.Difficulty = ConvertDifficultyTo_DTO(quiz.Difficulty, ref diff);

            List <Question_DTO> question_DTOs = new List <Question_DTO>();

            //Questions
            foreach (Question question in quiz.Questions)
            {
                var obj = new Question_DTO();
                question_DTOs.Add(ConvertQuestionTo_DTO(question, obj, quizRepo).Result);
            }

            quiz_DTO.Questions = question_DTOs;

            List <Result_DTO> result_DTOs = new List <Result_DTO>();

            //results
            foreach (Result result in quiz.Results)
            {
                var obj = new Result_DTO();
                result_DTOs.Add(ConvertResultTo_DTO(result, ref obj));
            }

            quiz_DTO.Results = result_DTOs;

            return(quiz_DTO);
        }
Exemplo n.º 2
0
        public static Difficulty ConvertDifficultyTo_Entity(Difficulty_DTO difficulty_DTO, ref Difficulty difficulty)
        {
            difficulty.Id          = difficulty_DTO.Id;
            difficulty.Description = difficulty_DTO.Description;

            return(difficulty);
        }
Exemplo n.º 3
0
 public static Difficulty_DTO ConvertDifficultyTo_DTO(Difficulty difficulty, ref Difficulty_DTO difficulty_DTO)
 {
     difficulty_DTO.Id          = difficulty.Id;
     difficulty_DTO.Description = difficulty.Description;
     return(difficulty_DTO);
 }