Exemple #1
0
        public async Task <EmployeeResponseModel> GetEmployeeAsync(int id)
        {
            EmployeeResponseModel  employeeModel = new EmployeeResponseModel();
            IEnumerable <Employee> employees     = await employeeService.GetEmployees();

            Employee employee = employees.SingleOrDefault(s => s.Id == id);

            if (employee != null)
            {
                ISalary salary = salaryFactory.SelectEmployeeType(employee.ContractTypeName);
                employeeModel = new EmployeeResponseModel
                {
                    Id               = employee.Id,
                    RoleId           = employee.RoleId,
                    RoleName         = employee.RoleName,
                    Name             = employee.Name,
                    RoleDescription  = employee.RoleDescription,
                    ContractTypeName = employee.ContractTypeName,
                    Salary           = salary.GetSalary(employee),
                    AnualSalary      = salary.GetAnualSalary(employee)
                };
            }


            return(employeeModel);
        }