コード例 #1
0
        private IEnumerable <Post> GetPages()
        {
            if (Cache.Pages == null)
            {
                var pages = MarkdownParser.ParseFiles(HttpContext.Current.Server.MapPath("~/Content/Pages"));
                SearchProvider.AddToIndex(pages);
                Cache.Pages = pages;
            }

            return(Cache.Pages.Where(p => p.IsPublished));
        }
コード例 #2
0
        private IEnumerable <Post> GetPosts()
        {
            if (Cache.Posts == null)
            {
                var posts = MarkdownParser.ParseFiles(HttpContext.Current.Server.MapPath("~/Content/Posts"));
                SearchProvider.AddToIndex(posts);
                Cache.Posts = posts;
            }

            return(Cache.Posts.Where(p => p.IsActive)
                   .OrderByDescending(p => p.Date));
        }