public IActionResult CreateDraftBlogPost(string name, [FromBody] CreateBlogPostRequest createBlogPostRequest) { var blog = BlogRepository.GetBlog(name); if (!Exists(blog)) { return(NotFound()); } var draftBlogPost = new DraftBlogPost(Guid.NewGuid(), createBlogPostRequest.Title, createBlogPostRequest.Content, createBlogPostRequest.BloggerId, DateTimeOffset.Now); blog.AddDraftBlogPost(draftBlogPost); //emit event return(Ok()); }
public static BlogPost CreateFromDraft(DraftBlogPost draftBlogPost) { return(new BlogPost(draftBlogPost.Id, draftBlogPost.Title, draftBlogPost.Content, draftBlogPost.AuthorId, DateTimeOffset.Now)); }
public void AddDraftBlogPost(DraftBlogPost draftBlogPost) { _draftBlogPosts.Add(draftBlogPost); }