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