コード例 #1
0
        public static BlogPost UpdateDetailsFrom(this BlogPost blogPost, Post post)
        {
            blogPost.Title = post.title;
            blogPost.Body = post.description;
            blogPost.PublishDate = post.dateCreated.ToUniversalTime();
            blogPost.Categories = post.categories.ToList();

            return blogPost;
        }
コード例 #2
0
        bool IMetaWeblog.UpdatePost( string postid, string username, string password,
                                     Post post, bool publish )
        {
            ThrowExceptionIfAuthenticationFailsFor(username, password);

            using (var documentSetssion = DocuemntStore.OpenSession())
            {
                var blogPost = documentSetssion.Load< BlogPost >( postid );

                blogPost.UpdateDetailsFrom( post );
                documentSetssion.SaveChanges();
            }

            return true;
        }
コード例 #3
0
        string IMetaWeblog.AddPost( string blogid, string username, string password,
                                    Post post, bool publish )
        {
            ThrowExceptionIfAuthenticationFailsFor( username, password );

            var blogPost = new BlogPost( post.title )
                               {
                                   DateAdded = DateTime.Now,
                               }.UpdateDetailsFrom(post);

            using( var documentSession = DocuemntStore.OpenSession() )
            {
                documentSession.Store( blogPost );
                documentSession.SaveChanges();
            }

            return blogPost.Id;
        }