Exemple #1
0
        public ActionResult Index(int id = 0)
        {
            var ops = new BlogPostOperations();
            var vm = new HomeIndexViewModel();
            //vm.BlogPosts = ops.GetBlogPosts();
            vm.Categories = ops.GetAllCategories();
            vm.StaticPages = ops.GetAllStaticPages();
            // paging
            var posts = ops.GetBlogPosts();
            vm.PostTotal = posts.Count;
            vm.RouteID = id;
            vm.BlogPosts = posts.Skip(id*5).Take(5).ToList();

            return View(vm);
        }