Beispiel #1
0
        public ActionResult StartTest(TestViewModel testModel)
        {
            var test = testModel.ToBll();

            test.MinProcentToPassTest = _testService.GetTestById(testModel.Id).MinProcentToPassTest;
            var result = _resultService.CheckTest(test);

            result.PassingTime = DateTime.Now - testModel.StartTime;
            var currentUser = _userService.GetUserByLogin(User.Identity.Name);

            result.UserId = currentUser.Id;
            result.Name   = _testService.GetTestById(testModel.Id).Name;
            _resultService.CreateTestResult(result);

            var model = result.ToMvc();

            model.CountOfQuestion = _testService.GetTestById(testModel.Id).Questions.Count;
            return(RedirectToAction("TestComplete", model));
        }