Esempio n. 1
0
 internal void Like(User user, Post post)
 {
     if (LikedPosts.ContainsKey(user))
     {
         LikedPosts[user].Add(post);
     }
     else
     {
         var posts = new List <Post> {
             post
         };
         LikedPosts.Add(user, posts);
     }
 }
Esempio n. 2
0
 internal void Like(User user, Post post)
 {
     // if the user exists
     if (LikedPosts.ContainsKey(user))
     {
         // add the post to the existing collection
         LikedPosts[user].Add(post);
     }
     else
     {
         // create a new list of post and add the user
         var posts = new List <Post> {
             post
         };
         LikedPosts.Add(user, posts);
     }
 }