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); }
public PartialViewResult Categories() { var viewModel = new CategoryViewModel(_category); return PartialView("_Categories", viewModel.Categories); }