示例#1
0
 public static bool UndoReaction(TweetDto.DtoTweet tweet)
 {
     UserReactionDto.DtoUserReaction undo = new UserReactionDto.DtoUserReaction
     {
         UserDetailId = tweet.UserDetailId,
         TweetId      = tweet.TweetId,
     };
     return(UserReactionDll.ReamoveReaction(undo));
 }
示例#2
0
 public static bool DisLike(TweetDto.DtoTweet tweet)
 {
     UserReactionDto.DtoUserReaction dislike = new UserReactionDto.DtoUserReaction
     {
         UserDetailId = tweet.UserDetailId,
         TweetId      = tweet.TweetId,
         IsLiked      = -1
     };
     return(UserReactionDll.AddToDislikes(dislike));
 }
示例#3
0
 public static bool ReamoveReaction(UserReactionDto.DtoUserReaction reactionObject)
 {
     try
     {
         using (GlitterDBEntities1 context = new GlitterDBEntities1())
         {
             //var react = context.Reacts.Find(reactObject.Id);
             var react = context.UserReactions.FirstOrDefault(l => l.UserReactionId == reactionObject.UserReactionId && l.UserDetailId == reactionObject.UserDetailId);
             context.UserReactions.Remove(react);
             context.SaveChanges();
         }
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
示例#4
0
 public static bool AddToDislikes(UserReactionDto.DtoUserReaction reactionObject)
 {
     try
     {
         using (GlitterDBEntities1 context = new GlitterDBEntities1())
         {
             context.UserReactions.Add(new UserReaction
             {
                 UserReactionId = reactionObject.UserReactionId,
                 UserDetailId   = reactionObject.UserDetailId,
                 IsLiked        = 1
             });
             context.SaveChanges();
         }
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }