コード例 #1
0
        public IActionResult details(int id)
        {
            var courseViewModel = new CourseDetailsViewModel();
            var course          = _repositoryCourse.GetCourseById(id);

            if (course == null)
            {
                return(RedirectToAction(nameof(Index)));
            }
            courseViewModel.course      = course;
            courseViewModel.authorCurso = course.Author;

            return(View(courseViewModel));
        }
コード例 #2
0
 public IActionResult OnGet(int id)
 {
     course = _repositoryCourse.GetCourseById(id);
     if (course == null)
     {
         return(RedirectToAction("Index", "Course"));
     }
     else
     {
         ListAuthor = _repositoryCourse.SelectListItemAuthor();
         return(Page());
     }
 }