예제 #1
0
        public HRStudentDataViewModel GetAllStudentViewData()
        {
            IList <Student> students = _studentService.GetAllStudents();

            if (students.Count == 0)
            {
                return(null);
            }

            HRStudentDataViewModel viewModel = new HRStudentDataViewModel
            {
                LanguageLevels = _languageService.GetAllLanguageLevels(),
                Streams        = _streamService.GetAllStreams(),
                TableData      = new List <HRStudentDataViewModel.TableRow>()
            };

            foreach (Student st in students)
            {
                UserInfo studentInfo = _studentService.GetUserInfo(st);
                Resume   resume      = _resumeService.GetResumeByStudentId(st.Id);
                HRStudentDataViewModel.TableRow row = new HRStudentDataViewModel.TableRow()
                {
                    StudentId                   = st.Id,
                    Choose                      = false,
                    Stream                      = _streamService.GetStreamByStudentId(st.Id),
                    RuName                      = studentInfo?.RuName,
                    RuSurname                   = studentInfo.RuSurname,
                    DateOfBirth                 = studentInfo.DateOfBirth,
                    Email                       = studentInfo.Email,
                    Phone                       = studentInfo.Phone,
                    TrainerEmail                = "*****@*****.**",
                    DateOfGraduation            = st.DateOfGraduation,
                    GraduationMark              = st.GraduationMark,
                    ParticipationOnPracticalLab = false,
                    Comments                    = null
                };

                if (resume == null)
                {
                    row.Languages       = null;
                    row.Status          = "new";
                    row.Specializations = null;
                }
                else
                {
                    row.Languages       = _languageService.GetAllForeignLanguagesForResume(resume.Id);
                    row.Status          = resume.Status;
                    row.Specializations = resume.Educations?.Select(s => s.Specialization);
                }

                var skills = _skillService.GetAllSkillsForStudent(st.Id);
                if (skills.Count() == 0)
                {
                    row.StudentSkills = _skillService.GetDefaultSkillsByStream(_streamService.GetStreamByStudentId(st.Id).Id);
                }
                else
                {
                    row.StudentSkills = skills;
                }
                viewModel.TableData.Add(row);
            }
            return(viewModel);
        }
 // api/classes
 public async Task <IActionResult> GetAllStreams()
 {
     return(await _streamService.GetAllStreams());
 }