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 AddHashTag(TweetDto.DtoTweet tweet) { IList <HashTagDto.DtoHashTag> hashTagsInTheMessage = SplitHashtags(tweet); bool isAdded = HashTagDll.AddToHashTagList(hashTagsInTheMessage); if (isAdded == true) { return(true); } else { return(false); } }
public static bool RemoveHashTag(TweetDto.DtoTweet tweet) { //string message = tweet.Content; IList <HashTagDto.DtoHashTag> hashTagsInThisMessage = SplitHashtags(tweet); bool isDeleted = HashTagDll.DeleteFromHashTagList(hashTagsInThisMessage); if (isDeleted == true) { return(true); } else { return(false); } }
private static IList <HashTagDto.DtoHashTag> SplitHashtags(TweetDto.DtoTweet tweet) { IList <HashTagDto.DtoHashTag> listOfHashTagsInMessage = new List <HashTagDto.DtoHashTag>(); var regex = new Regex(@"(?<=#)\w+"); var hashTagsInMessage = regex.Matches(tweet.TweetContent); foreach (Match m in hashTagsInMessage) { var newhashtag = new HashTagDto.DtoHashTag { HashTagName = m.ToString(), TweetId = tweet.TweetId, }; listOfHashTagsInMessage.Add(newhashtag); } return(listOfHashTagsInMessage); }
public static TweetDto.DtoTweet EditTweet(TweetDto.DtoTweet beforeedit, TweetDto.DtoTweet afteredit) { if (BsHashTag.RemoveHashTag(beforeedit)) { if (BsHashTag.AddHashTag(afteredit)) { return(TweetDll.EditTweet(afteredit)); } else { return(null); } } else { return(null); } }
public static bool DeleteTweet(TweetDto.DtoTweet tweet) { if (BsHashTag.RemoveHashTag(tweet)) { if (BsUserReaction.UndoReaction(tweet)) { return(TweetDll.DeleteTweet(tweet)); } else { return(false); } } else { return(false); } }
public static TweetDto.DtoTweet AddTweet(int userid, string content) { { TweetDto.DtoTweet tweets = new TweetDto.DtoTweet() { TweetContent = content, UserDetailId = userid, Date = DateTime.Now }; TweetDto.DtoTweet addTweet = TweetDll.AddTweet(tweets); if (addTweet != null) { return(addTweet); } else { return(null); } } }