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)); }
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)); }
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)); }