public Tweet[] GetUserTweets(string userName, int skip = 0, int take = 20) { if (UsersByName.TryGetValue(userName, out var user)) { return(user.Tweets.Skip(skip).Take(take).ToArray()); } throw new ArgumentException("No such user: " + userName); }
public void Unfollow(string followerName, string followeeName) { if (UsersByName.TryGetValue(followerName, out var follower)) { if (UsersByName.TryGetValue(followeeName, out var followee)) { follower.Followees.Remove(followee); followee.Followers.Remove(follower); return; } throw new ArgumentException("No such user: "******"No such user: " + followerName); }
public virtual User GetUserOrDefaultByName(string id) { User u; return(UsersByName.TryGetValue(id, out u) ? u : null); }