Beispiel #1
0
        public PasswordExamDTO GetFixedExam(Guid examId)
        {
            PasswordExamDTO fixedExam = new PasswordExamDTO();

            questionRepository.ListByExamId(examId).ForEach(x =>
            {
                List <ExamineeAnswerDTO> examineeAnswers = new List <ExamineeAnswerDTO>();
                answerRepository.ListByQuestionId(x.Id).ForEach(y => examineeAnswers.Add(new ExamineeAnswerDTO
                {
                    Content = y.Content,
                    Id      = y.Id
                }));

                fixedExam.ExamineeQuestions.Add(new ExamineeQuestionDTO
                {
                    Id      = x.Id,
                    Content = x.Content,
                    Answers = examineeAnswers,
                    Type    = x.Type
                });
            });

            fixedExam.TimeRemaining = String.Empty;
            return(fixedExam);
        }
Beispiel #2
0
        public PasswordExamDTO GetRandomExam(Guid examId)
        {
            var             exam    = examRepository.GetRandomExam(examId);
            Guid            bankId  = exam.BankId;
            PasswordExamDTO examDTO = new PasswordExamDTO();

            examDTO.ExamineeQuestions.AddRange(bankService.ListRandomQuestion(bankId, exam.NumberOfEasyQuestion, 1));
            examDTO.ExamineeQuestions.AddRange(bankService.ListRandomQuestion(bankId, exam.NumberOfNormalQuestion, 2));
            examDTO.ExamineeQuestions.AddRange(bankService.ListRandomQuestion(bankId, exam.NumberOfHardQuestion, 3));

            examDTO.TimeRemaining = exam.Time;
            examDTO.Name          = exam.Name;
            return(examDTO);
        }