示例#1
0
        public ViewResult Posts(string categorySlug, int page = 1)
        {
            var viewModel = new CategoryViewModel(_category, categorySlug, _post, page, pageLimit);

            if (viewModel.Category == null)
                throw new HttpException(404, "Category not found");

            ViewBag.Title = String.Format(@"Latest posts on category ""{0}""",
                                viewModel.Category.Name);

            ViewBag.Page = page;

            return View(viewModel);
        }
示例#2
0
        public PartialViewResult Categories()
        {
            var viewModel = new CategoryViewModel(_category);

            return PartialView("_Categories", viewModel.Categories);
        }