Example #1
0
        // GET: Comments/Create
        public async Task <IActionResult> Create(Product product)
        {
            var    userId = User.FindFirstValue(ClaimTypes.NameIdentifier);
            Client user   = await _userManager.FindByIdAsync(userId);

            if (CommentsService.AllowComment(user: user, productRecherche: product.Id))
            {
                ViewBag.UserId    = userId;
                ViewBag.ProductId = product.Id;

                return(PartialView());
            }

            return(RedirectToAction("DetailsCard", "Products", product.Id));
        }