public async Task <IActionResult> Students(int id) { var userId = _userManager.GetUserId(this.User); if (!await _trainerService.IsTrainer(id, userId)) { return(NotFound()); } var studentsInCourseViewModel = new StudentsInCourseViewModel { Students = await _trainerService.StudentsInCourseAsync(id), Course = await _courseService.ByIdAsync <CourseListingServiceModel>(id) }; return(View(studentsInCourseViewModel)); }
public async Task <IActionResult> Students(int courseId) { var trainerId = this.userManageer.GetUserId(this.User); var isTrainerInCourse = await this.trainerService.IsTrainerInCourse(trainerId, courseId); if (!isTrainerInCourse) { return(this.NotFound()); } var students = new StudentsInCourseViewModel { Students = await this.trainerService.StudentsInCourseAsync(courseId), Course = await this.courseService.DetailsAsync <CourseListingInfoServiceModel>(courseId) }; return(this.View(students)); }