public bool DeleteEmployee(Employee employee) { var selectedEmployee = Db.Employees.Find(employee.Id); Db.Entry(selectedEmployee).State = System.Data.Entity.EntityState.Deleted; return SaveDbChanges(); }
public bool Save(Employee employee) { if (employee.Id <= 0) { Db.Employees.Add(employee); } else { Db.Employees.Attach(employee); Db.Entry(employee).State = EntityState.Modified; } return SaveDbChanges(); }