Ejemplo n.º 1
0
        public ViewResult Posts(int pageNumber = 1)
        {
            var listViewModel = new ListViewModel(blogRepository, pageNumber);

            ViewBag.Title = "Latests posts";

            return View("List", listViewModel);
        }
Ejemplo n.º 2
0
        public ViewResult Search(string searchCritera, int pageNumber = 1)
        {
            ViewBag.Title = String.Format(@"Lists of posts found for search text ""{0}""", searchCritera);

            var viewModel = new ListViewModel(blogRepository, searchCritera, "Search", pageNumber);

            return View("List", viewModel);
        }
Ejemplo n.º 3
0
        public ViewResult Category(string category, int pageNumber = 1)
        {
            var viewModel = new ListViewModel(blogRepository, category, "Category", pageNumber);

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

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

            return View("List", viewModel);
        }
Ejemplo n.º 4
0
        public ViewResult Tag(string tag, int pageNumber = 1)
        {
            var viewModel = new ListViewModel(blogRepository, tag, "Tag", pageNumber);

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

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

            return View("List", viewModel);
        }