public async Task <IActionResult> Details(int courseId) { Course courseFromDB = _coursesRepository.GetById(courseId); SubjectViewModel subjectFromDB = _subjectsRepository.GetById(courseFromDB.Subject.SubjectId); List <CourseModuleEditViewModel> modulesFromDB = await _coursesRepository.GetScheduleModules(courseId); List <Student> students = await _studentsRepository.GetStudentsByCourse(courseId); User userFromDB = await _usersRepository.GetByEmail(courseFromDB.Teacher.Email); CourseDetailsViewModel courseDetailsViewModel = new CourseDetailsViewModel() { Course = courseFromDB, Subject = new Subject() { SubjectId = subjectFromDB.SubjectId, Name = subjectFromDB.Name, Description = subjectFromDB.Description }, Teacher = new AspNetUsers() { FirstName = userFromDB.FirstName, LastName = userFromDB.LastName, MiddleName = userFromDB.MiddleName }, Modules = modulesFromDB, Students = students }; return(View(courseDetailsViewModel)); }