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); } }
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); } }
public void AddLikedPost(Post i_LikedPost) { LikedPosts.Add(i_LikedPost); }