示例#1
0
        public ActionResult Quiz(string guid)
        {
            var testUrlDomain = _getInfoService.GetTestingUrlByGuid(guid);
            var error         = _advancedLogicService.CheckTestingUrlForAvailability(testUrlDomain);

            if (!string.IsNullOrEmpty(error))
            {
                return(View("TestingErrorView", (object)error));
            }
            //if all is ok
            var testUrl = _advancedMapper.MapTestingUrl(testUrlDomain);
            var model   = new ModelAndInfo <TestingUrlViewModel>
            {
                TransferModel = testUrl,
                Guid          = guid
            };

            CurrentTest = new TestPassingViewModel()
            {
                TestingStartDateTime = DateTime.Now.ToString(),
                Interviewee          = testUrl.Interviewee,
                TestingGuid          = testUrl.TestGuid
            };
            return(View(model));
        }
示例#2
0
        public ActionResult FinishTest(TestPassingViewModel testPassing)
        {
            var testPassingMapped = _advancedMapper.MapTestPassingViewModel(testPassing);

            _advancedLogicService.FinishQuiz(testPassingMapped);
            return(RedirectToAction("GetAllTestingResults", "Admin"));
        }
        public TestingResult MapTestPassingViewModel(TestPassingViewModel testPassingViewModel)
        {
            var result = _mapper.Map <TestingResult>(testPassingViewModel);

            if (result.Duration == TimeSpan.Zero)
            {
                result.Duration = result.TestingEndDateTime - result.TestingStartDateTime;
            }

            result.TestingUrl           = _getInfoService.GetTestingUrlByGuid(testPassingViewModel.TestingGuid);
            result.Test                 = result.TestingUrl.Test;
            result.TestingResultAnswers = MapTestingResultAnswers(testPassingViewModel.Questions, result);

            return(result);
        }
示例#4
0
        public void FinishTest(TestPassingViewModel testPassing)
        {
            var testPassingMapped = _advancedMapper.MapTestPassingViewModel(testPassing);

            _advancedLogicService.FinishQuiz(testPassingMapped);
        }