Exemple #1
0
        public ActionResult Create(NewTestView view)
        {
            if (ModelState.IsValid)
            {
                var response = MovementsHelper.NewTest(view, User.Identity.Name);
                if (response.Succeeded)
                {
                    return(RedirectToAction("Index"));
                }
                ModelState.AddModelError(string.Empty, response.Message);
            }

            var user = db.Users.Where(u => u.UserName == User.Identity.Name).FirstOrDefault();

            ViewBag.UserID       = new SelectList(db.Users, "UserID", "UserName", view.UserID);
            view.SummaryDetails  = db.TestSummaryDetailTmps.Where(tdt => tdt.UserName == User.Identity.Name).ToList();
            view.QuestionDetails = db.TestQuestionDetailTmps.Where(tdt => tdt.UserName == User.Identity.Name).ToList();
            return(View(view));
        }