public IActionResult AllCourses(string searchString = null, int page = 1)
        {
            this.RedirectUnauthorized();

            var model = new CoursesSummaryViewModel
            {
                Courses        = this.courseService.All(searchString, page),
                SearchString   = searchString,
                ControllerName = nameof(TrainerController).Replace("Controller", string.Empty),
                ActionName     = nameof(CourseDetails)
            };

            return(View(model));
        }
示例#2
0
        public IActionResult AllCourses(string searchString = null, int page = 1)
        {
            this.RedirectUnauthenticated();

            var studentId = this.userManager.GetUserId(base.User);

            var model = new CoursesSummaryViewModel
            {
                Courses        = this.courseService.AllByStudent(studentId, searchString, page),
                LoggedUserId   = studentId,
                SearchString   = searchString,
                ControllerName = nameof(StudentController).Replace("Controller", string.Empty),
                ActionName     = nameof(CourseDetails)
            };

            return(View(model));
        }
示例#3
0
        public IActionResult All(string searchString = null, int page = 1)
        {
            var model = new CoursesSummaryViewModel
            {
                Courses        = this.courseService.All(searchString, page),
                SearchString   = searchString,
                ControllerName = nameof(CourseController).Replace("Controller", string.Empty),
                ActionName     = nameof(Details)
            };

            var isAuthenticated = User.Identity.IsAuthenticated;

            if (isAuthenticated)
            {
                model.LoggedUserId = this.userManager.GetUserId(User);
            }

            return(View(model));
        }