public bool AddTweet(TweetDto newTweet) { operationOnTweet = new TweetOperation(); operationOnTag = new HashTags(); int tweetId; newTweet.Body = newTweet.Body.Trim(); if (string.IsNullOrEmpty(newTweet.Body)) { return(false); } tweetId = operationOnTweet.AddTweet(newTweet); tagList = SplitTweet(newTweet.Body); tagId = operationOnTag.AddHashTag(tagList); TweetTagMap(tweetId, tagId); return(true); }
public bool UpdateTweet(TweetDto newTweet) { operationOnTweet = new TweetOperation(); operationOnTag = new HashTags(); mapper = new PostTagMapOperation(); newTweet.Body = newTweet.Body.Trim(); tagList = SplitTweet(newTweet.Body); if (string.IsNullOrEmpty(newTweet.Body)) { return(false); } tagId = mapper.RetrieveTagId(newTweet.id); mapper.Remove(newTweet.id); operationOnTag.RemoveHashtag(tagId); tagId = operationOnTag.AddHashTag(tagList); operationOnTweet.EditTweet(newTweet); TweetTagMap(newTweet.id, tagId); return(true); }