Exemple #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));
 }
Exemple #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));
 }
Exemple #3
0
        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);
            }
        }
Exemple #4
0
        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);
            }
        }
Exemple #5
0
        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);
        }
Exemple #6
0
 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);
     }
 }
Exemple #7
0
 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);
     }
 }
Exemple #8
0
        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);
                }
            }
        }