示例#1
0
 public void UpdateEmployee(Employee employee)
 {
     using (var context = new HumanResourceContext())
     {
         context.Entry <Employee>(employee).State = EntityState.Modified;
         context.SaveChanges();
     }
 }
示例#2
0
 public void DeleteDepartment(Department department)
 {
     using (var context = new HumanResourceContext())
     {
         context.Entry <Department>(department).State = EntityState.Deleted;
         context.SaveChanges();
     }
 }
示例#3
0
 public void AddEmployee(Employee employee)
 {
     using (var context = new HumanResourceContext())
     {
         context.Employees.Add(employee);
         context.SaveChanges();
     }
 }
示例#4
0
 public void AddDepartment(Department department)
 {
     using (var context = new HumanResourceContext())
     {
         context.Departments.Add(department);
         context.SaveChanges();
     }
 }
示例#5
0
 public void DeleteEmployee(Employee employee)
 {
     using (var context = new HumanResourceContext())
     {
         Employee theEmployee = GetEmployee(employee.Id);
         context.Entry <Employee>(theEmployee).State = EntityState.Deleted;
         context.SaveChanges();
     }
 }