Esempio n. 1
0
        /// <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);
        }
Esempio n. 2
0
        /// <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);
        }