public ActionResult Create([Bind(Include = "TestId,Name")] Test test)
        {
            if (ModelState.IsValid)
            {
                db.Tests.Add(test);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(test));
        }
Beispiel #2
0
        public ActionResult Create([Bind(Include = "TeacherId,FirstName,SecondName,IsBoss")] Teacher teacher)
        {
            if (ModelState.IsValid)
            {
                db.Teachers.Add(teacher);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(teacher));
        }
Beispiel #3
0
        public ActionResult Create([Bind(Include = "QuestionId,Title,DifficultyLevel,CreationDate")] Question question)
        {
            if (ModelState.IsValid)
            {
                db.Questions.Add(question);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(question));
        }
        public ActionResult Create([Bind(Include = "AnswerId,QuestionId,AnswerField,isCorrect")] Answer answer)
        {
            if (ModelState.IsValid)
            {
                db.Answers.Add(answer);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.QuestionId = new SelectList(db.Questions, "QuestionId", "Title", answer.QuestionId);
            return(View(answer));
        }
        public ActionResult Create([Bind(Include = "SubjectId,Name,SubjectTypeId")] Subject subject)
        {
            if (ModelState.IsValid)
            {
                db.Subjects.Add(subject);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.SubjectTypeId = new SelectList(db.SubjectTypes, "SubjectTypeId", "Type", subject.SubjectTypeId);
            return(View(subject));
        }
Beispiel #6
0
        public ActionResult Create([Bind(Include = "InstitutionId,InstitutionName,InstitutionTypeId")] Institution institution)
        {
            if (ModelState.IsValid)
            {
                db.Institutions.Add(institution);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.InstitutionTypeId = new SelectList(db.InstitutionTypes, "InstitutionTypeId", "Type", institution.InstitutionTypeId);
            return(View(institution));
        }