コード例 #1
0
ファイル: LikesService.cs プロジェクト: wojtek-rak/PaintStore
        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);
            }
        }