コード例 #1
0
        public ActionResult Lecturing()
        {
            var userId  = User.Identity.GetUserId();
            var courses = _dbContext.Followings
                          .Where(a => a.FollowerId == userId)
                          .Select(p => p.Followee)
                          .ToList();
            //var couresese = _dbContext.Courses.Where(p => courses.Contains(p.Id)).Include(p => p.Lecturer).Include(p => p.Category).ToList();
            var viewModel = new LecturersViewModel
            {
                LecturersFollow = courses,
                ShowAction      = User.Identity.IsAuthenticated
            };

            return(View(viewModel));
        }
コード例 #2
0
        public ActionResult Following()
        {
            var userId = User.Identity.GetUserId();

            var users = _DbContext.Followings
                        .Where(f => f.FollowerId == userId)
                        .Select(f => f.Followee)
                        .ToList();

            var viewModel = new LecturersViewModel
            {
                FollowingLecturers = users,
                ShowAction         = User.Identity.IsAuthenticated,
            };

            return(View(viewModel));
        }