Esempio n. 1
0
        public async Task <bool> DeleteDependentsByEmployeeId(int employeeId)
        {
            using (var unitOfWork = _unitOfWorkFactory.CreateUnitOfWork())
            {
                var isDeleted = await _dependentDal.DeleteDependentsByEmployeeId(unitOfWork, employeeId);

                await unitOfWork.Complete();

                return(isDeleted);
            }
        }
Esempio n. 2
0
        public async Task <bool> DeleteEmployee(int id)
        {
            using (var unitOfWork = _unitOfWorkFactory.CreateUnitOfWork())
            {
                // delete all the dependents associated with the employee first
                var isDeleted = await _dependentDal.DeleteDependentsByEmployeeId(unitOfWork, id);

                if (!isDeleted)
                {
                    return(false);
                }
                await _employeeDal.DeleteEmployee(unitOfWork, id);

                //complete the transaction
                await unitOfWork.Complete();

                return(true);
            }
        }