예제 #1
0
 public void SaveDept(Department dept)
 {
     using (var _deptContext = new DataContext())
     {
         _deptContext.Department.Add(dept);
         _deptContext.SaveChanges();
     }
 }
예제 #2
0
 public void EditDept(Department deptToEdit)
 {
     using (var _deptContext = new DataContext())
     {
         var selectedDEpt = _deptContext.Department.Where(x => x.DeptID == deptToEdit.DeptID).SingleOrDefault();
         selectedDEpt.DeptName = deptToEdit.DeptName;
         _deptContext.SaveChanges();
     }
 }