Exemplo n.º 1
0
        public ActionResult SaveAttemp(int?id)
        {
            var quiz = cx.Quizzes.Find(id);

            var testSave = (TestSave)Session["save"];

            quiz = cx.Quizzes.Find(quiz.Id);

            var attemp = new QuizAttempt()
            {
                Quiz = quiz,
                Time = DateTime.Now,
                User = cx.Users.Find(UserManager.FindByName(User.Identity.Name).Id),
                Type = (AttempType)Session["AttemptType"],
            };

            if (attemp.Type == AttempType.ByGroup)
            {
                attemp.Group = cx.Groups.Find((int)Session["GroupId"]);
            }

            var saver = new AttemptSaver(testSave, cx, attemp, helper);

            attemp = saver.Attempt;

            return(RedirectToAction("GetAttepmt", "Cabinet", new { id = attemp.Id }));
        }
Exemplo n.º 2
0
        public IActionResult PutTestAttemptAnswers([FromBody] ConcreteAttemptInputModel concreteAttempt)
        {
            Mapper       mapper = new Mapper();
            AttemptSaver saver  = new AttemptSaver();

            saver.CreateAttemptResult(mapper.ConvertConcreteAttemptInputModelToConcreteAttemptBusinessModel(concreteAttempt));
            return(new OkResult());
        }