public List<string> Add(EmployeeEntity employee) { DbContext.EmployeeRepository.Add(employee); return DbContext.Commit(); }
public List<string> Edit(EmployeeEntity employee) { DbContext.Entry(employee).State = EntityState.Modified; return DbContext.Commit(); }
public List<string> Remove(EmployeeEntity emp, bool notPurging = true) { EmployeeEntity employee = DbContext.EmployeeRepository.GetAll().FirstOrDefault(u => u.EmployeeId == emp.EmployeeId); var errors = new List<string>(); if (employee != null) { if (notPurging) { employee.RecordState.RecordStateType = RecordStateType.Inactive; employee.RecordState.ModfiedByUserId = employee.RecordState.ModfiedByUserId; DbContext.Entry(employee).State = EntityState.Modified; } else DbContext.Entry(employee).State = EntityState.Deleted; } else { errors.Add("Custom : No such employee mateches the id"); } return errors; }