protected void Page_Load(object sender, EventArgs e) { PostQueries postRepository = new PostQueries(Config.GetLog()); var posts = postRepository.FindLastXPosts(10); repLatestPosts.DataSource = posts; repLatestPosts.DataBind(); }
private void BindPost() { PostQueries postRepository = new PostQueries(Config.GetLog()); int postId = this.GetCurrentPostId(); MyBlog.Reporting.Projections.DTOPost post = postRepository.FindById(postId); this.litPublishDate.Text = Utils.FormatDate(post.PublishDate.Value); this.litSubject.Text = Utils.FormatText(post.Subject); this.litBody.Text = Utils.FormatText(post.Body); this.litCommentCount.Text = post.Comments.Count().ToString(); this.litCategories.Text = FormatCategories(post.Categories); //Up to the page to decide how to order the comments this.repReplies.DataSource = post.Comments.OrderBy(c => c.CreationDate); this.repReplies.DataBind(); pnlReply.Visible = post.CommentsEnabled; }