Example #1
0
 public PostInfoRecord(MP.PostInfo p)
 {
     this.Title        = p.Title;
     this.Link         = p.Link;
     this.DateCreated  = p.DateCreated;
     this.PostId       = p.PostId;
     this.UserId       = p.UserId;
     this.CommentCount = p.CommentCount;
     this.PostStatus   = p.PostStatus;
     this.Permalink    = p.Permalink;
     this.Description  = p.Description;
     this.Categories   = BlogServer.join_cat_strings(p.Categories.Select(s => s.Trim()));
 }
Example #2
0
        public void Edit(string postid, DateTime?created, string title, string desc, IList <string> cats, bool publish)
        {
            var post = this.TryGetPostById(postid);

            if (post == null)
            {
                // Post was not found
                throw new System.ArgumentException("Post Not Found");
                //respond_error_invalid_postid_parameter(context, 200);
            }

            var newpost = post.Value;

            if (title != null)
            {
                newpost.Title = title;
            }

            if (desc != null)
            {
                newpost.Description = desc;
            }

            if (cats != null)
            {
                // Reset the post categories
                newpost.Categories = BlogServer.join_cat_strings(cats);
            }

            if (publish)
            {
                newpost.PostStatus = "published";
            }
            else
            {
                newpost.PostStatus = "draft";
            }

            this.Dictionary[newpost.PostId] = newpost;
        }