Beispiel #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));
        }
Beispiel #2
0
        public ActionResult CreateTestingUrl(string testGuid)
        {
            var model = new ModelAndInfo <TestingUrlViewModel>
            {
                Guid = testGuid
            };

            return(View(model));
        }
Beispiel #3
0
 public ActionResult CreateAnswer(string questionGuid)
 {
     if (questionGuid != null)
     {
         var model = new ModelAndInfo <AnswerViewModel>
         {
             Guid = questionGuid
         };
         return(View(model));
     }
     return(HttpNotFound());
 }
Beispiel #4
0
 public ActionResult CreateQuestion(string testGuid)
 {
     if (testGuid != null)
     {
         var model = new ModelAndInfo <QuestionViewModel>
         {
             TransferModel = new QuestionViewModel(),
             Guid          = testGuid
         };
         return(View(model));
     }
     return(HttpNotFound());
 }
Beispiel #5
0
 public ActionResult UpdateQuestion(string questionGuid)
 {
     if (questionGuid != null)
     {
         var testQuestion = _advancedMapper.MapTestQuestion(_getInfoService.GetQuestionByGuid(questionGuid));
         if (testQuestion != null)
         {
             var model = new ModelAndInfo <QuestionViewModel>
             {
                 TransferModel = testQuestion,
                 Guid          = questionGuid
             };
             return(View(model));
         }
     }
     return(HttpNotFound());
 }
Beispiel #6
0
        public ActionResult UpdateQuestion(ModelAndInfo <QuestionViewModel> model)
        {
            if (ModelState.IsValid)
            {
                var testQuestion = _mapper.Map <TestQuestion>(model.TransferModel);
                if (testQuestion != null)
                {
                    _lowLevelTestManagementService.UpdateQuestion(model.Guid, testQuestion);

                    return(RedirectToAction(actionName: "GetQuestionsByTestGuid",
                                            controllerName: "Test",
                                            routeValues: new
                    {
                        testGuid = Session["testGuid"]
                    }));
                }
                return(HttpNotFound());
            }
            return(View(model));
        }
Beispiel #7
0
        public ActionResult CreateQuestion(string testGuid, ModelAndInfo <QuestionViewModel> model)
        {
            if (ModelState.IsValid)
            {
                if (testGuid != null)
                {
                    var testQuestion = _mapper.Map <TestQuestion>(model.TransferModel);
                    _lowLevelTestManagementService.CreateQuestionForTest(testGuid, testQuestion);

                    return(RedirectToAction(actionName: "GetQuestionsByTestGuid",
                                            controllerName: "Test",
                                            routeValues: new
                    {
                        TestGuid = testGuid
                    }));
                }
                return(HttpNotFound());
            }
            return(View(model));
        }
Beispiel #8
0
        public ActionResult CreateAnswer(string questionGuid, ModelAndInfo <AnswerViewModel> model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }
            if (questionGuid == null)
            {
                return(HttpNotFound());
            }

            var testAnswer = _mapper.Map <TestAnswer>(model.TransferModel);

            _lowLevelTestManagementService.CreateAnswerForQuestion(questionGuid, testAnswer);

            return(RedirectToAction(actionName: "GetAnswersByQuestionGuid",
                                    controllerName: "Test",
                                    routeValues: new
            {
                QuestionGuid = questionGuid
            }));
        }
Beispiel #9
0
        public ActionResult CreateTestingUrl(ModelAndInfo <TestingUrlViewModel> model)
        {
            if (model != null)
            {
                if (model.TransferModel.AllowedEndDate == null)
                {
                    model.TransferModel.AllowedEndDate = new DateTime().ToString();
                }
                if (model.TransferModel.AllowedStartDate == null)
                {
                    model.TransferModel.AllowedStartDate = new DateTime().ToString();
                }
            }
            if (ModelState.IsValid)
            {
                var testUrlDomain = _advancedMapper.MapTestingUrlViewModel(model.TransferModel);
                _highLevelTestManagementService.CreateTestingUrl(testUrlDomain);
                return(RedirectToAction("TestingUrlManagement", "Admin"));
            }

            return(View(model));
        }