コード例 #1
0
        public ActionResult Create(AuditCourse auditcourse)
        {
            auditcourse.setNextCourseNumber();
            if (ModelState.IsValid)
            {
                db.Courses.Add(auditcourse);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.ProgramId = new SelectList(db.Programs, "ProgramID", "ProgramAcronym", auditcourse.ProgramId);
            return(View(auditcourse));
        }
コード例 #2
0
        public ActionResult Create([Bind(Include = "CourseId,ProgramId,CourseNumber,Title,CreditHours,TuitionAmount,Notes")] AuditCourse auditCourse)
        {
            auditCourse.setNextCourseNumber();
            if (ModelState.IsValid)
            {
                db.AuditCourses.Add(auditCourse);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.ProgramId = new SelectList(db.Programs, "ProgramId", "Description", auditCourse.ProgramId);
            return(View(auditCourse));
        }