예제 #1
0
        public ActionResult Create(Department department)
        {
            if (ModelState.IsValid)
            {
                db.Departments.Add(department);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.InstructorID = new SelectList(db.Instructors, "InstructorID", "FirstMidName", department.InstructorID);
            return View(department);
        }
예제 #2
0
 public ActionResult Edit(Department department)
 {
     if (ModelState.IsValid)
     {
         db.Entry(department).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.InstructorID = new SelectList(db.Instructors, "InstructorID", "FirstMidName", department.InstructorID);
     return View(department);
 }