示例#1
0
        public IResult ActivateEmployee(IActivateEmployeeParameters values)
        {
            var employeeKey = KeyParserHelper.ParseResult <IEmployeeKey>(values.EmployeeKey);
            var employee    = _coreUnitOfWork.EmployeesRepository.FindBy(e => e.EmployeeId.Equals(employeeKey.ResultingObject.EmployeeKey_Id));

            if (employee == null)
            {
                return(new InvalidResult <IEmployeeDetailsReturn>(null, string.Format(UserMessages.EmployeeByKeyNotFound, values.EmployeeKey)));
            }

            employee.EmailAddress = values.EmailAddress;
            employee.IsActive     = true;
            _coreUnitOfWork.Commit();
            return(new SuccessResult("Employee activated successfully."));
        }