/// <summary> /// Get an employee from the ID. /// </summary> /// <param name="employeeId">identification of employee</param> /// <returns></returns> public async Task <ViewModelEmployee> GetEmployeeById(int employeeId) { var employee = await _employeeRepository.GetEmployeeById(employeeId); var viewModelEmployee = employee != null?EmployeeFactory.GetAnualSalarybyEmployee(employee) : null; return(viewModelEmployee); }
/// <summary> /// Method that return List with all employees. /// </summary> /// <returns></returns> public async Task <List <ViewModelEmployee> > GetAllEmployees() { List <ViewModelEmployee> lstEmployees = new List <ViewModelEmployee>(); var employeesList = await _employeeRepository.GetAllEmployees(); foreach (var employee in employeesList) { var viewModelEmployee = EmployeeFactory.GetAnualSalarybyEmployee(employee); lstEmployees.Add(viewModelEmployee); } return(lstEmployees); }