Beispiel #1
0
 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);
     }
 }