public void CommentLike(string userId, int commentId,
                                string likeSpan, string dislikeSpan)
        {
            Likes like = repository.Likes
                         .FirstOrDefault(l => l.For == "Comment" && l.ForId == commentId &&
                                         l.UserId == userId);

            if (like == null)
            {
                like = new Likes
                {
                    For    = "Comment",
                    ForId  = commentId,
                    UserId = userId
                };
                repository.AddLike(like);

                //notification
                _ = ShowNotification(userId, commentId);
            }
            else
            {
                repository.DeleteLike(like.Id);
            }

            _ = CommentLikesDislikesInitial(userId, commentId, likeSpan, dislikeSpan);
        }
        public ActionResult AddLike(string userId, string For, int forId, string spanId)
        {
            ViewData["Id"] = userId;

            Likes like = new Likes
            {
                For    = For,
                ForId  = forId,
                UserId = userId
            };

            repository.AddLike(like);

            return(PartialView("LikesDislikesCount", new LikesDislikes
            {
                For = For,
                ForId = forId,
                spanId = spanId,
                Likes = repository.Likes.Where(l => l.For == For && l.ForId == forId),
                Dislikes = repository.Dislikes.Where(d => d.For == For && d.ForId == forId)
            }));
        }
        public async Task VideoLikes(int videoId, string userId)
        {
            bool  likeInd    = false;
            bool  dislikeInd = false;
            Likes like       = repository.Likes
                               .FirstOrDefault(l => l.For == "Video" &&
                                               l.ForId == videoId && l.UserId == userId);

            if (like == null)
            {
                like = new Likes
                {
                    For    = "Video",
                    ForId  = videoId,
                    UserId = userId
                };
                repository.AddLike(like);
                likeInd = true;

                _ = ShowNotification(userId, videoId);
            }
            else
            {
                repository.DeleteLike(like.Id);
            }

            int totalLikes = repository.Likes
                             .Where(l => l.For == "Video" && l.ForId == videoId)
                             .Count();
            int totalDislikes = repository.Dislikes
                                .Where(d => d.For == "Video" && d.ForId == videoId)
                                .Count();

            await Clients.All.SendAsync("AddRemoveLike", videoId, userId,
                                        totalLikes, likeInd, totalDislikes, dislikeInd);
        }