Ejemplo n.º 1
0
        public ActionResult Create([Bind(Include = "Student_stuID,Courses_courseID,question1,question2,question3,question4,question5,question6,question7,question8,question9,question10")] Student_has_Courses student_has_Courses)
        {
            if (ModelState.IsValid)
            {
                db.Student_has_Courses.Add(student_has_Courses);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.Courses_courseID = new SelectList(db.Courses, "courseID", "Major_majorID", student_has_Courses.Courses_courseID);
            ViewBag.Student_stuID    = new SelectList(db.Students, "stuID", "Major_majorID", student_has_Courses.Student_stuID);
            return(View(student_has_Courses));
        }
Ejemplo n.º 2
0
        public ActionResult Index(CourseEval crsform)
        {
            var cid = Session["courseid"];
            var Uid = User.Identity.Name;

            ViewBag.Cid   = cid;
            ViewBag.Stdid = Uid;

            using (var context = new CourseEvalDB_WDEntities())
            {
                var    Stdnt     = context.Students.First(x => x.loginStu == Uid);
                string StudentID = Stdnt.stuID;
                WebApi.Student_has_Courses StrCrs = context.Student_has_Courses.First(x => x.Courses_courseID == (string)cid && x.Student_stuID == StudentID);
                StrCrs.Courses_courseID = (string)cid;
                StrCrs.Student_stuID    = StudentID;
                StrCrs.question1        = crsform.question1;
                StrCrs.question2        = crsform.question2;
                StrCrs.question3        = crsform.question3;
                StrCrs.question4        = crsform.question4;
                StrCrs.question5        = crsform.question5;
                StrCrs.question6        = crsform.question6;
                StrCrs.question7        = crsform.question7;
                StrCrs.question8        = crsform.question8;
                StrCrs.question9        = crsform.question9;
                StrCrs.question10       = crsform.question10;

                context.SaveChanges();
            }

            return(RedirectToAction("Index", "stuHome"));
        }