/// <summary> /// Creates a new entry in WordPress determined by Post.PostType to be a "Post", "Page", or custom post type /// </summary> /// <param name="post">The post to create</param> /// <returns></returns> public string NewPost(Post post) { var post_put = new Post_Put(); CopyPropertyValues(post, post_put); var terms = new XmlRpcStruct(); if (post.Terms != null) { var termTaxes = post.Terms.GroupBy(t => t.Taxonomy); foreach (var grp in termTaxes) { var termIds = grp.Select(g => g.Id).ToArray(); terms.Add(grp.Key, termIds); } post_put.Terms = terms; } if (post_put.PostType == "post" && String.IsNullOrEmpty(post_put.CommentStatus)) { post_put.CommentStatus = "open"; } return(WordPressService.NewPost(WordPressSiteConfig.BlogId, WordPressSiteConfig.Username, WordPressSiteConfig.Password, post_put)); }
private Post_Put NewPostPut(Post post) { var post_put = new Post_Put(); CopyPropertyValues(post, post_put); var terms = new XmlRpcStruct(); if (post.Terms != null) { var termTaxes = post.Terms.GroupBy(t => t.Taxonomy); foreach (var grp in termTaxes) { var termIds = grp.Select(g => g.Id).ToArray(); terms.Add(grp.Key, termIds); } post_put.Terms = terms; } if (post_put.PostType == "post" && String.IsNullOrEmpty(post_put.CommentStatus)) { post_put.CommentStatus = "open"; } return(post_put); }
public bool EditPost(Post post) { var post_put = new Post_Put(); CopyPropertyValues(post, post_put); var terms = new XmlRpcStruct(); var termTaxes = post.Terms.GroupBy(t => t.Taxonomy); foreach (var grp in termTaxes) { var termIds = grp.Select(g => g.Id).ToArray(); terms.Add(grp.Key, termIds); } post_put.Terms = terms; return(WordPressService.EditPost(WordPressSiteConfig.BlogId, WordPressSiteConfig.Username, WordPressSiteConfig.Password, int.Parse(post_put.Id), post_put)); }
private Post_Put EditPostPut(Post post) { var post_put = new Post_Put(); CopyPropertyValues(post, post_put); if (post.Terms != null) { var terms = new XmlRpcStruct(); var termTaxes = post.Terms.GroupBy(t => t.Taxonomy); foreach (var grp in termTaxes) { var termIds = grp.Select(g => g.Id).ToArray(); terms.Add(grp.Key, termIds); } post_put.Terms = terms; } return(post_put); }