public void Edit(Employee employee) { using (var context = new ElysiumContext()) { var dbEmployee = context.Employee.Find(employee.Id); context.Entry(dbEmployee).CurrentValues.SetValues(employee); context.SaveChanges(); } }
public void Delete(Guid id) { using (var context = new ElysiumContext()) { var employee = new Employee() { Id = id }; var settings = new EmployeeSettings { Id = id }; context.Entry(settings).State = EntityState.Deleted; context.SaveChanges(); context.Employee.Attach(employee); context.Entry(employee).State = EntityState.Deleted; context.SaveChanges(); } }