Пример #1
0
        public PostForProcessing(Post post)
        {
            original = post;

            Blog               = new BlogReadOnly(post.Blog);
            Body               = post.Body;
            Excerpt            = post.BodyShort;
            Comments           = post.Comments.Select(c => new CommentReadOnly(c, "")).ToArray();
            CommentingDisabled = post.CommentingDisabled;
            Created            = post.Created;
            Creator            = new UserReadOnly(post.Creator);
            Modified           = post.Modified;
            Published          = post.Published;
            Slug               = post.Slug;
            IsPending          = post.State == Oxite.Models.EntityState.PendingApproval;
            Tags               = post.Tags.Select(t => new TagReadOnly(t)).ToArray();
            Title              = post.Title;
            Trackbacks         = post.Trackbacks.Select(tb => new TrackbackReadOnly(tb)).ToArray();
        }
Пример #2
0
 public PostReadOnly(Post post, string url)
 {
     Blog               = new BlogReadOnly(post.Blog);
     Body               = post.Body;
     Excerpt            = post.BodyShort;
     Comments           = post.Comments.Select(c => new CommentReadOnly(c, "")).ToArray();
     CommentingDisabled = post.CommentingDisabled;
     Created            = post.Created;
     Creator            = new UserReadOnly(post.Creator);
     Modified           = post.Modified;
     IsPublished        = post.Published.HasValue && post.Published.Value <= DateTime.UtcNow;
     PublishedDate      = post.Published.GetValueOrDefault();
     Slug               = post.Slug;
     State              = (State)(byte)post.State;
     Tags               = post.Tags.Select(t => new TagReadOnly(t)).ToArray();
     Title              = post.Title;
     Trackbacks         = post.Trackbacks.Select(tb => new TrackbackReadOnly(tb)).ToArray();
     Url = url;
 }