public void Add(Employee employee) { using (var context = new ElysiumContext()) { context.Employee.Add(employee); context.SaveChanges(); } }
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 Add(EmployeeHistory employeeHistory) { using (var context = new ElysiumContext()) { context.EmployeeHistory.Add(employeeHistory); context.SaveChanges(); } }
public void Add(EmployeeSettings employeeSettings) { using (var context = new ElysiumContext()) { context.EmployeeSettings.Add(employeeSettings); 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(); } }
public void Delete(Guid Id) { using (var context = new ElysiumContext()) { var employeeHistory = new EmployeeHistory() { Id = Id }; context.EmployeeHistory.Remove(employeeHistory); context.SaveChanges(); } }
public void Delete(Guid Id) { using (var context = new ElysiumContext()) { var employeeSettings = new EmployeeSettings() { Id = Id }; context.EmployeeSettings.Remove(employeeSettings); context.SaveChanges(); } }