public void SaveDept(Department dept) { using (var _deptContext = new DataContext()) { _deptContext.Department.Add(dept); _deptContext.SaveChanges(); } }
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(); } }