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