public TransitImage(ISession session, DBlog.Data.Image o, bool withthumbnail, bool withdata, bool hasaccess) : base(o.Id) { Name = o.Name; Path = o.Path; Counter = TransitCounter.GetAssociatedCounter <DBlog.Data.Image, ImageCounter>( session, o.Id); if (hasaccess) { Preferred = o.Preferred; Description = o.Description; Modified = o.Modified; CommentsCount = 0; // hack: disable comments, using disqus //CommentsCount = new CountQuery(session, typeof(ImageComment), "ImageComment") // .Add(Expression.Eq("Image.Id", o.Id)) // .Execute<int>(); if (withthumbnail) { Thumbnail = o.Thumbnail; } if (withdata) { Data = o.Data; } } }
public TransitPost(ISession session, DBlog.Data.Post o, bool hasaccess) : base(o.Id) { Title = o.Title; Slug = o.Slug; HasAccess = hasaccess; if (hasaccess) { mRawBody = o.Body; Body = Render(session, o.Body); BodyXHTML = RenderXHTML(session, o); } LoginId = o.Login.Id; if (o.PostImages != null && o.PostImages.Count > 0) { ImagesCount = o.PostImages.Count; if (hasaccess) { ImageId = ((PostImage)TransitObject.GetRandomElement(o.PostImages)).Image.Id; } } // topics List <TransitTopic> topics = new List <TransitTopic>(); if (o.PostTopics != null) { foreach (PostTopic postTopic in o.PostTopics) { topics.Add(new TransitTopic(postTopic.Topic)); } } mTopics = topics.ToArray(); Created = o.Created; Modified = o.Modified; CommentsCount = new CountQuery(session, typeof(PostComment), "PostComment") .Add(Expression.Eq("Post.Id", o.Id)) .Execute <int>(); Counter = TransitCounter.GetAssociatedCounter <Post, PostCounter>( session, o.Id); Publish = o.Publish; Display = o.Display; Sticky = o.Sticky; Export = o.Export; }