示例#1
0
        public IActionResult Like(Guid id)
        {
            if (_signInManager.IsSignedIn(User))
            {
                var item   = _productService.GetByID(id);
                var UserId = _userManager.GetUserId(User);

                if (!_likesServices.CheckUserId(item, UserId))
                {
                    _likesServices.AddLike(item);
                    _likesServices.AddUserIdToProducts(item, UserId);
                    return(RedirectToAction("Index", new { id }));
                }
            }
            return(RedirectToAction("Index", new { id }));
        }