Example #1
0
        public IActionResult Details(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            StudentViewModel studentViewModel = _classroomService.GetStudentById(id.Value);

            if (studentViewModel == null)
            {
                return(NotFound());
            }

            return(View(studentViewModel));
        }
        public IActionResult List(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            ListGradeViewModel listGradeViewModel = new ListGradeViewModel
            {
                Student = _classroomService.GetStudentById(id.Value),
                Grades  = _classroomService.ListGradesByStudentId(id.Value),
                Courses = _classroomService.ListFreeCoursesByStudent(id.Value)
            };

            if (listGradeViewModel.Student == null)
            {
                return(NotFound());
            }

            return(View(listGradeViewModel));
        }