/// <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); }
protected override async Task OnInitializedAsync() { Employees = await EmployeeDataService.GetAllEmployees(); InitializeJobCategories(); InitializeCountries(); //return base.OnInitializedAsync(); }
protected async override Task OnInitializedAsync() { Employees = (await EmployeeDataService.GetAllEmployees()).ToList(); }