示例#1
0
        public IActionResult Index()
        {
            var posts           = _postManager.List().OrderByDescending(s => s.ReleaseDate).ToList();
            var indexViewModels = posts.Select(p => new IndexViewModel
            {
                Id            = p.Id,
                Title         = p.Title,
                ReleaseDate   = p.ReleaseDate,
                Category      = p.Category,
                HtmlDesc      = p.HtmlDesc,
                ShortHtmlDesc = PostHelper.GetShortHtmlDesc(p.HtmlDesc)
            }).ToList();

            return(View(indexViewModels));
        }