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); } }
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); }