コード例 #1
0
        public async Task <IActionResult> Index(int page = 1)
        {
            var model = new CoursesListingViewModel
            {
                Courses = await this.courseService.GetAllCoursesAsync(page),

                TotalCourses = await this.courseService.GetTotalCoursesCount(),

                CurrentPage = page
            };

            return(View(model));
        }
コード例 #2
0
        public async Task <IActionResult> Index()
        {
            var userId = this.userManager.GetUserId(User);

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

            var model = new CoursesListingViewModel
            {
                Courses = await this.trainerService.GetCoursesByTrainerIdAsync(userId)
            };

            return(View(model));
        }