示例#1
0
        public async Task <IActionResult> Index(int id)
        {
            var course = await courseService.GetFullCourseByIdAsync(id);

            var userId = User.FindFirstValue(ClaimTypes.NameIdentifier);

            if (!string.IsNullOrWhiteSpace(userId))
            {
                ViewBag.IsInShoppingCart = await appCourseListService.IsInListAsync(id, userId, CourseListType.ShoppingCart);

                ViewBag.IsInWishList = await appCourseListService.IsInListAsync(id, userId, CourseListType.WishList);

                ViewBag.IsPurchased = await appCourseListService.IsPurchasedAsync(id, userId);
            }
            return(View(course));
        }