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(); }
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; }