コード例 #1
0
ファイル: LikesService.cs プロジェクト: wojtek-rak/PaintStore
 public CommentLikes AddCommentLike(CommentLikes like)
 {
     using (var db = _paintStoreContext)
     {
         if ((db.CommentLikes.Any(x => x.CommentId == like.CommentId && x.UserId == like.UserId)))
         {
             throw new NegotiatedContentResultException();
         }
         CommentsManager.CommentLikesCountPlus(db, like.CommentId);
         db.CommentLikes.Add(like);
         db.SaveChanges();
         return(like);
     }
 }