public async Task <Employee> GetEmployeeById(int idEmployee) { try { EmployeeSalary emp = await _employeeRepository.GetEmployeeById(idEmployee); return(emp != null?EmployeeFactory.GetFullEmployee(emp) : null); } catch (Exception e) { Console.WriteLine(e); throw; } }
public async Task <List <Employee> > GetEmployees() { try { List <EmployeeSalary> employees = await _employeeRepository.GetEmployees(); List <Employee> lstEmployee = new List <Employee>(); foreach (var emp in employees) { Employee employee = EmployeeFactory.GetFullEmployee(emp); lstEmployee.Add(employee); } return(lstEmployee); } catch (Exception e) { Console.WriteLine(e); throw; } }