Beispiel #1
0
        public PersonnelViewModel GetPersonnelViewModel()
        {
            PersonnelViewModel personnelViewModel = new PersonnelViewModel();
            var currentDepartmentId = _userService.GetCurrent().Employe.Department.Id;

            personnelViewModel.Department =
                _mapper.Map <DepartmentViewModel>(
                    _departmentRepository
                    .Get(currentDepartmentId));

            personnelViewModel.Department.Employes =
                _employeRepository.GetEmployesByDepartment(currentDepartmentId)
                .Select(x => _mapper.Map <ShortEmployeViewModel>(x))
                .ToList();

            foreach (var x in personnelViewModel.Department.Employes)
            {
                if (_bankAccountRepository.GetSpecifiedAccountByEmploye(x.Id, BankAccountType.Salary) != null)
                {
                    x.HasSalaryAccount = true;
                }
            }

            personnelViewModel.RequestsToEmploy =
                _employeRepository.GetRequestsToEmploy(currentDepartmentId)
                .Select(x => _mapper.Map <RequestViewModel>(x.User))
                .ToList();
            return(personnelViewModel);
        }