Ejemplo n.º 1
0
        public static async Task <IEnumerable <EmployeeDto> > GetEmployees()
        {
            var employees = await EmployeeDal.GetEmployees();

            var employeesDto = new List <EmployeeDto>();

            foreach (var employee in employees)
            {
                employeesDto.Add(EmployeesFactory.GetEmployee(employee));
            }
            return(employeesDto);
        }
Ejemplo n.º 2
0
        public static async Task <IEnumerable <EmployeeDto> > GetEmployee(int id)
        {
            var employees = await EmployeeDal.GetEmployees();

            Employee employee = employees.FirstOrDefault(emp => emp.Id == id);

            if (employee == null)
            {
                return new EmployeeDto[] { }
            }
            ;
            return(new EmployeeDto[] { EmployeesFactory.GetEmployee(employee) });
        }
    }