コード例 #1
0
        public virtual ActionResult Index()
        {
            var posts = from post in repository.FindAll()
                        orderby post.PublishDate descending
                        select post;
            var recentPosts    = posts.Skip(0).Take(10).ToList();
            var postViewModels = mapper.MapAll <Post, PostViewModel>(recentPosts);
            var viewModel      = new HomeViewModel {
                Posts = postViewModels
            };

            return(View(viewModel));
        }