Example #1
0
        public bool Remove(EmployeeRemoveCommand cmd)
        {
            Employee employeeDb = _repositoryEmployee.GetById(cmd.Id) ?? throw new NotFoundException();

            if (_repositorySpending.EmployeeWithSpending(cmd.Id))
            {
                employeeDb.IsActive = false;
                _repositoryEmployee.Update(employeeDb);
                return(false);
            }

            return(_repositoryEmployee.Remove(employeeDb));
        }