Exemplo n.º 1
0
 public string NewPost(string blogid, string username, string password, PostInfo postInfo, bool publish)
 {
     ValidateUser(username, password);
     try
     {
         var post = _postTasks.SaveNewPost(new PostCreateDetails
         {
             Title = postInfo.title,
             AllowComments = postInfo.mt_allow_comments,
             AuthorUserName = username,
             Content = postInfo.description,
             Excerpt = postInfo.mt_excerpt,
             Published = publish,
             Tags = postInfo.mt_keywords,
             Slug = postInfo.wp_slug
         });
         return ("http://localhost/post/" + post.Slug);
     }
     catch (Exception ex) {
         return "";
     }
 }
Exemplo n.º 2
0
 public bool UpdatePost(string postid, string username, string password, PostInfo postInfo, bool publish)
 {
     ValidateUser(username, password);
     try {
         _postTasks.UpdatePost(new PostEditDetails {
             Title = postInfo.title,
             AllowComments = postInfo.mt_allow_comments,
             AuthorUserName = username,
             Content = postInfo.description,
             Excerpt = postInfo.mt_excerpt,
             Id = new Guid(postid),
             Published = publish,
             Tags = postInfo.mt_keywords,
             Slug = postInfo.wp_slug
         });
         return true;
     } catch (Exception ex) {
         return false;
     }
 }