public static bool UndoReaction(TweetDto.DtoTweet tweet) { UserReactionDto.DtoUserReaction undo = new UserReactionDto.DtoUserReaction { UserDetailId = tweet.UserDetailId, TweetId = tweet.TweetId, }; return(UserReactionDll.ReamoveReaction(undo)); }
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)); }
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); } }
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); } }