Пример #1
0
        public void AddPostToUser(User user, Post post)
        {
            var userInState = Users[user.Name];

            userInState.Posts.Add(post);
            PostsUpdated?.Invoke(userInState.Name);
            user.Apply(userInState);
        }
 private void Posts_NewUpdated(object sender, PostsUpdateEventArgs e)
 {
     try {
         PostsUpdated.Invoke(e);
     } catch (Exception ex) {
         Console.WriteLine(ex.Message);
     }
 }
Пример #3
0
        public void AddComment(string postOwner, Guid postId, Comment comment)
        {
            var userInState = Users[postOwner];
            var post        = userInState.Posts.First(p => p.Id == postId);

            post.Comments.Add(comment);

            PostsUpdated?.Invoke(postOwner);
        }