public void AddDept(DepartmentNameGroup Department)
        {
            Department s = new Department
            {
                DeptID = Department.DeptID,
                Title  = Department.Title,
            };

            db.Departments.Add(s);
            db.SaveChanges();
        }
Exemple #2
0
 public ActionResult CreateDept([Bind(Include = "DeptID, Title")] DepartmentNameGroup d)
 {
     try
     {
         if (ModelState.IsValid)
         {
             Istudent.AddDept(d);
             return(RedirectToAction("Departments"));
         }
     }
     catch (RetryLimitExceededException /* dex */)
     {
         //Log the error (uncomment dex variable name and add a line here to write a log.
         ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists see your system administrator.");
     }
     return(View(d));
 }