Beispiel #1
0
        public async Task <IActionResult> GetCommentsPartial(int id)
        {
            var comments = await _commentService.GetCommentsByProductAsync(id);

            // if (User.Identity.IsAuthenticated)
            //  {
            //  var authorizedUser = await _userManager.FindByNameAsync(User.Identity.Name);
            //  var res = await _commentService.GetCommentAllIncludedAsync(1);
            var userId = "6cab4e64-cd04-4ba5-94d4-3c9b5ad2e78f";

            ViewBag.Likes = await _likeService.GetLikedCommentsIdAsync(userId, id);

            ViewBag.Dislikes = await _likeService.GetDislikedCommentsIdAsync(userId, id);

            //   }
            return(PartialView(_mapper.Map <List <CommentViewModel> >(comments.Take(5))));
        }