public async Task <EmployeeInfoViewModel> GetEmployeeInfo(string employeeId) { var viewModel = new EmployeeInfoViewModel(); var employee = await _employeeService.GetByEmployeeIdWithDetailAsync(employeeId); if (employee != null) { viewModel.Departments = await _employeeDetailService.GetDepartments(); viewModel.Shifts = await _employeeDetailService.GetShifts(); viewModel.JobPosition = await _employeeDetailService.GetPositions(); viewModel.JobLevels = await _employeeDetailService.GetLevels(); viewModel.Routes = await _employeeDetailService.GetRoutes(); //viewModel.BusStations = await _employeeDetailService.GetBusStations(); if (employee.EmployeeState != null) { viewModel.EmployeeId = employee.EmployeeState.EmployeeId; viewModel.DepartmentId = employee.EmployeeState.JobFunction.Section.Department.DepartmentId; viewModel.SectionId = employee.EmployeeState.JobFunction.Section.SectionId; viewModel.ShiftId = employee.EmployeeState.ShiftId; viewModel.JobPositionId = employee.EmployeeState.PositionId; viewModel.JobFunctionId = employee.EmployeeState.JobFunctionId; viewModel.LevelId = employee.EmployeeState.LevelId; viewModel.RouteId = employee.EmployeeState.BusStation.Route.RouteId; viewModel.BusStationId = employee.EmployeeState.BusStationId; viewModel.JoinDate = employee.EmployeeState.JoinDate; viewModel.Sections = await _employeeDetailService.GetSectionsByDepartmentId(viewModel.DepartmentId); viewModel.JobFunctions = await _employeeDetailService.GetJobFunctionsBySectionId(viewModel.SectionId); viewModel.BusStations = await _employeeDetailService.GetGetBusStationsByRouteId(viewModel.RouteId); } var profileHeader = new ProfileHeaderViewModel() { FullName = $"{employee.Title}.{employee.FirstName} {employee.LastName}", FullNameThai = $"{employee.TitleThai}.{employee.FirstNameThai} {employee.LastNameThai}", ProfileImage = await GetProfileImage(employeeId) }; viewModel.ProfileHeader = profileHeader; } return(viewModel); }