Ejemplo n.º 1
0
        public int RemoveCommentLike(int userId, int commentId)
        {
            using (var db = _paintStoreContext)
            {
                var likeId = db.CommentLikes.First(x => x.CommentId == commentId && x.UserId == userId).Id;

                CommentsManager.CommentLikesCountMinus(db, db.CommentLikes.First(x => x.Id == likeId).CommentId);
                db.CommentLikes.Remove(db.CommentLikes.First(x => x.Id == likeId));
                db.SaveChanges();
                return(likeId);
            }
        }