예제 #1
0
        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());
        }
예제 #2
0
 public static BlogPost CreateFromDraft(DraftBlogPost draftBlogPost)
 {
     return(new BlogPost(draftBlogPost.Id, draftBlogPost.Title, draftBlogPost.Content, draftBlogPost.AuthorId, DateTimeOffset.Now));
 }
예제 #3
0
 public void AddDraftBlogPost(DraftBlogPost draftBlogPost)
 {
     _draftBlogPosts.Add(draftBlogPost);
 }