Beispiel #1
0
        /** Follower follows a followee. If the operation is invalid, it should be a no-op. */
        public void Follow(int followerId, int followeeId)
        {
            var user = Users.Find(x => x.ID == followerId);

            if (user != null)
            {
                user.FollowerIDs.Add(followeeId);
            }
            else
            {
                var newUser = new TweetUser(followerId);
                newUser.FollowerIDs.Add(followeeId);
                Users.Add(newUser);
            }
        }
Beispiel #2
0
        /** Compose a new tweet. */
        public void PostTweet(int userId, int tweetId)
        {
            TweetOrders.Add(tweetId);
            var user = Users.Find(x => x.ID == userId);

            if (user != null)
            {
                TweetNews.Add(tweetId, user);
            }
            else
            {
                var newUser = new TweetUser(userId);
                Users.Add(newUser);
                TweetNews.Add(tweetId, newUser);
            }
        }