Ejemplo n.º 1
0
        /// <summary>
        /// Gets all employees of a company
        /// </summary>
        /// <param name="companyId">Compamny id</param>
        /// <param name="userId">user id </param>
        /// <param name="userManagerId"> manager id </param>
        /// <returns></returns>
        public AllEployeesViewModel GetAllEmployees(int?companyId, string userId, string userManagerId)
        {
            var allEmployeesViewModel = new AllEployeesViewModel()
            {
                Employees = employeeDataService.GetAllEmployees(companyId, userId, userManagerId)
                            .Select(e => new EmployeeViewModel
                {
                    EmployeeId         = e.EmployeeId,
                    FirstName          = e.FirstName,
                    MiddleName         = e.MiddleName,
                    LastName           = e.LastName,
                    Salary             = e.Salary,
                    JobTitle           = jobTitleDataService.FindById(e.JobTitleId).Name,
                    Department         = depatmentDataService.FindById(e.DepartmentId).DepartmentName,
                    IsCompanyConfirmed = e.IsCompanyConfirmed,
                    Subordinates       = e.Employees.Select(e => new EmployeeViewModel
                    {
                        EmployeeId         = e.EmployeeId,
                        FirstName          = e.FirstName,
                        MiddleName         = e.MiddleName,
                        LastName           = e.LastName,
                        Salary             = e.Salary,
                        JobTitle           = jobTitleDataService.FindById(e.JobTitleId).Name,
                        Department         = depatmentDataService.FindById(e.DepartmentId).DepartmentName,
                        IsCompanyConfirmed = e.IsCompanyConfirmed
                    })
                                         .ToArray()
                })
                            .ToArray()
            };

            return(allEmployeesViewModel);
        }
Ejemplo n.º 2
0
        protected override async Task OnInitializedAsync()
        {
            Employees = await EmployeeDataService.GetAllEmployees();

            InitializeJobCategories();
            InitializeCountries();
            //return base.OnInitializedAsync();
        }
Ejemplo n.º 3
0
 protected async override Task OnInitializedAsync()
 {
     Employees = (await EmployeeDataService.GetAllEmployees()).ToList();
 }