Esempio n. 1
0
 string IMetaWeblog.AddPost(String blogid, String username, String password, Post post, Boolean publish)
 {
     if (ValidateUserFromFeed(blogid, username, password))
     {
         return repository.AddPost(Convert.ToInt32(blogid), username, password, post.title, post.description, post.categories).ToString();
     }
     throw new XmlRpcFaultException(0, "User is not valid!");
 }
Esempio n. 2
0
 Post IMetaWeblog.GetPost(String postid, String username, String password)
 {
     if (ValidateUserFromPost(postid, username, password)) {
         BlogEntry blogEntry = repository.GetPost(Convert.ToInt32(postid));
         Post post = new Post {
             postid = blogEntry.BlogEntry_ID.ToString(),
             dateCreated = blogEntry.Published,
             description = blogEntry.Content,
             permalink = blogEntry.URL,
             title = blogEntry.Title,
             userid = blogEntry.Author
         };
         return post;
     }
     throw new XmlRpcFaultException(0, "User is not valid!");
 }
Esempio n. 3
0
 Post[] IMetaWeblog.GetRecentPosts(String blogid, String username, String password, Int32 numberOfPosts)
 {
     if (ValidateUserFromFeed(blogid, username, password))
     {
         List<Post> posts = new List<Post>();
         var entries = repository.GetRecentPosts(Convert.ToInt32(blogid), username, password, numberOfPosts);
         Post post;
         foreach (var item in entries)
         {
             post = new Post {
                 postid = item.BlogEntry_ID.ToString(),
                 dateCreated = item.Published,
                 description = item.Content,
                 permalink = item.URL,
                 title = item.Title,
                 userid = item.Author
             };
             posts.Add(post);
         }
         return posts.ToArray();
     }
     throw new XmlRpcFaultException(0, "User is not valid!");
 }
Esempio n. 4
0
 bool IMetaWeblog.UpdatePost(String postid, String username, String password, Post post, Boolean publish)
 {
     if (ValidateUserFromPost(postid, username, password))
     {
         //Boolean result = false;
         repository.UpdatePost(Convert.ToInt32(postid), post.title, post.description, post.categories);
         return true;
     }
     throw new XmlRpcFaultException(0, "User is not valid!");
 }