Exemplo n.º 1
0
        public async Task <IActionResult> StudentInfo([FromRoute] string id)
        {
            Student student = await studentRepository.Get(id);

            student.Group = await groupRepository.Get(student.GroupId);

            List <Mark> studentMarks = await markRepository.GetMarksByStudent(student.Id);

            for (int i = 0; i < studentMarks.Count; i++)
            {
                if (studentMarks[i].CourseId != null)
                {
                    studentMarks[i].Course = await courseRepository.Get(studentMarks[i].CourseId);
                }
                else
                {
                    Lesson temp = await lessonRepository.Get(studentMarks[i].LessonId);

                    GroupCourse gc = await groupCourseRepository.Get(temp.GroupCourseId);

                    studentMarks[i].Course = await courseRepository.Get(gc.CourseId);
                }
            }

            return(View(new StudentInfoViewModel()
            {
                Student = student,
                Marks = studentMarks
            }));
        }