public List <EmployeeDTO> ConsumeEmployeeTestAPI() { try { List <EmployeeDTO> employeeData = dataAccessClass.ConsumeEmployeesTestAPI(); employeeData.Where(x => x.contractTypeName.Equals(Constants.HourlySalaryEmployee)).Select(y => { contractSalaryFactory = new ContractSalaryFactory(); AbstractContractType contractSalary = contractSalaryFactory.GetContractSalary(y); y.AnualHourlySalary = contractSalary.CalculateAnnualHourlySalary(y.hourlySalary); return(y); }).ToList(); employeeData.Where(x => x.contractTypeName.Equals(Constants.MonthlySalaryEmployee)).Select(y => { contractSalaryFactory = new ContractSalaryFactory(); AbstractContractType contractSalary = contractSalaryFactory.GetContractSalary(y); y.AnualMonthlySalary = contractSalary.CalculateAnnualMonthlySalary(y.monthlySalary); return(y); }).ToList(); return(employeeData); } catch (Exception ex) { throw ex; } }