Beispiel #1
0
        private void UpsertTempPreviewTest1(TempPreviewTest tempPreviewTestDetails)
        {
            var tempPreviewTestPrevious = GetTempPreviewTest(tempPreviewTestDetails);

            if (tempPreviewTestPrevious != null)
            {
                tempPreviewTestPrevious.QuestionIds = tempPreviewTestDetails.QuestionIds;
                _context.Update(tempPreviewTestPrevious);
            }
            else
            {
                _context.Add(tempPreviewTestDetails);
            }
        }
Beispiel #2
0
        private List <int> GetQuestionsForPreviewTestSuite(PreviewTestBusinessModel previewTestBusinessModel)
        {
            var questionIds = new List <int>();
            var previewTest = new TempPreviewTest {
                TestSuiteId = previewTestBusinessModel.TestSuite.TestSuiteId, ViewerId = previewTestBusinessModel.ViewerId
            };
            var previewTestDetails = GetTempPreviewTestSuite(previewTest);

            if (previewTestDetails != null)
            {
                if (!string.IsNullOrWhiteSpace(previewTestDetails.QuestionIds))
                {
                    questionIds = previewTestDetails.QuestionIds.Split(',').Select(int.Parse).ToList();
                }
            }
            return(questionIds.OrderBy(ques => ques).ToList());
        }
Beispiel #3
0
        public List <Question> GetPreview(PreviewTestBusinessModel previewTest)
        {
            var questionIds            = new List <int>();
            var tempPreviewTestDetails = new TempPreviewTest();
            var questions = GenerateQuestionSet(previewTest.TestSuite);

            if (questions.Any())
            {
                questions = questions.OrderBy(ques => ques.Id).ToList();
                questionIds.AddRange(questions.Select(question => question.Id));
                tempPreviewTestDetails.QuestionIds = string.Join(",", questionIds);
                tempPreviewTestDetails.ViewerId    = previewTest.ViewerId;
                tempPreviewTestDetails.CandidateId = previewTest.CandidateId;
                tempPreviewTestDetails.TestSuiteId = previewTest.TestSuite.TestSuiteId;
            }
            UpsertTempPreviewTest1(tempPreviewTestDetails);
            return(questions);
        }
Beispiel #4
0
 private TempPreviewTest GetTempPreviewTestSuite(TempPreviewTest tempPreviewTestDetails)
 {
     return(_context.Query <TempPreviewTest>().FirstOrDefault(temp => temp.ViewerId == tempPreviewTestDetails.ViewerId &&
                                                              temp.TestSuiteId == tempPreviewTestDetails.TestSuiteId));
 }