Ejemplo n.º 1
0
        public async Task <IEnumerable <Employee> > Get()
        {
            var employees = await employeeRepository.GetAll();

            if (employees == null)
            {
                return(employees);
            }

            foreach (var employee in employees)
            {
                var calculateAnnualSalaryService = await calculateAnnualSalaryFactory.GetCalculator(employee);

                await calculateAnnualSalaryService.Calculate(employee);
            }

            return(employees);
        }
        public async Task <Employee> Get(int employeeId)
        {
            var employees = await employeeRepository.GetAll();

            if (employees == null || !employees.Any())
            {
                return(null);
            }

            var employee = employees.FirstOrDefault(x => x.Id == employeeId);

            if (employee == null || !employees.Any())
            {
                return(employee);
            }

            var calculateAnnualSalaryService = await calculateAnnualSalaryFactory.GetCalculator(employee);

            await calculateAnnualSalaryService.Calculate(employee);

            return(employee);
        }