Пример #1
0
        public ActionResult Index()
        {
            var upcomingCourses = _dbContext.Courses.Include(c => c.Lecturer).Include(c => c.Category).Where(c => c.DateTime > DateTime.Now).ToList();
            var viewModel       = new CoursesViewModel
            {
                UpcomingCourses = upcomingCourses,
                ShowAction      = User.Identity.IsAuthenticated
            };

            return(View(viewModel));
        }
Пример #2
0
        public ActionResult Attending()
        {
            var userId = User.Identity.GetUserId();

            var courses = _dbContext.Attendances
                          .Where(a => a.AttendeeId == userId)
                          .Select(a => a.Course)
                          .Include(l => l.Lecturer)
                          .Include(l => l.Category)
                          .ToList();
            var viewModel = new CoursesViewModel
            {
                UpcommingCourses = courses,
                ShowAction       = User.Identity.IsAuthenticated
            };

            return(View(viewModel));
        }