public void AddBlogPost(int blogId, string title) { int id = Repository.Add(new BlogPost(blogId, title)); IEvent evnt = new BlogPostAdded(id, blogId, title); Raise(evnt); }
public void BlogPostAdded(string @event) { BlogPostAdded data = DeserializeEvent <BlogPostAdded>(@event); Console.WriteLine($"Added BlogPost {data.Id} to Blog {data.BlogId}"); }
public void When(BlogPostAdded blogPostAdded) { _posts.Add(new(blogPostAdded.PostId, blogPostAdded.Title)); }