예제 #1
0
        public ActionResult <CandidateTestModel> GetTest(int testId)
        {
            var testEntity = _interviewService.GetTest(testId);

            if (testEntity == null)
            {
                return(NotFound("No tests found"));
            }

            var retVal = new CandidateTestModel(testEntity);

            if (!testEntity.TestQuestions.Any())
            {
                return(retVal);
            }

            retVal.TestQuestions = new List <TestQuestionModel>();
            testEntity.TestQuestions.ForEach(i =>
            {
                retVal.TestQuestions.Add(new TestQuestionModel()
                {
                    TestQuestionId = i.TestQuestionsId,
                    Answer         = i.Answer,
                    Question       = new QuestionModel()
                    {
                        QuestionId  = i.QuestionId,
                        Answer      = i.Question.Answer,
                        Description = i.Question.Description,
                        Level       = (int)i.Question.Level,
                        Text        = i.Question.Text,
                        Type        = (int)i.Question.Type
                    }
                });
            });

            return(retVal);
        }
예제 #2
0
 public CandidateTestSummary(CandidateTestModel candidateTest)
 {
     TestId     = candidateTest.TestId;
     TestResult = candidateTest.TestResult;
     TestAnswer = candidateTest.TestAnswer;
 }
 public CandidateTestStatus(CandidateTestModel candidateTest)
 {
     TestName   = $"Test {candidateTest.TestId}";
     TestStatus = candidateTest.EndTime == null?Status.NotCompleted : Status.Completed;
 }