Esempio n. 1
0
        public IViewComponentResult Invoke(ViewMode view)
        {
            var recentPosts = _repo.AllIncluding(i => i.Category).OrderByDescending(o => o.UpdatedDate).Take(3);
            var model       = new LatestPostsViewModel()
            {
                View  = view,
                Posts = _mapper.ProjectTo <PostViewModel>(recentPosts).ToList()
            };

            return(View(model));
        }
Esempio n. 2
0
        public void OnGet()
        {
            var posts = _repo.AllIncluding(p => p.Category).OrderByDescending(o => o.CreatedDate);

            Data = _mapper.ProjectTo <PostViewModel>(posts).ToPaginatedList(CurrentPage, PageSize);
        }
        //
        // GET: /Posts/

        public ViewResult Index()
        {
            return(View(postRepository.AllIncluding(p => p.Files)));
        }