Example #1
0
        public ActionResult Create(Question question)
        {
            if (ModelState.IsValid)
            {
                db.Questions.Add(question);
                db.SaveChanges();
                return(RedirectToRoute(new { controller = "A", action = "Create", id = question.QuestionId }));
            }

            return(View(question));
        }
Example #2
0
        public ActionResult Create(TestModel testmodel)
        {
            if (ModelState.IsValid)
            {
                db.Tests.Add(testmodel);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(testmodel));
        }
Example #3
0
        public ActionResult Create(AnswerVariant answervariant)
        {
            if (ModelState.IsValid)
            {
                db.AnswerVariants.Add(answervariant);
                db.SaveChanges();
                return(RedirectToRoute(new { controller = "A", action = "Create", id = answervariant.QuestionId }));
            }

            return(RedirectToRoute("Error"));
        }