Esempio n. 1
0
        public ActionResult List(string slug, int page = 1)
        {
            var pagedList = _commentRepository.GetCommentsForEntry(slug).AsQueryable().ToPagedList(page, _pageSize);

            var routeValues = new RouteValueDictionary();
            routeValues["slug"] = slug;

            var model = new ListViewModel
            {
                Items = pagedList,
                TemplateName = "DisplayTemplates/CommentListItem",
                ActionName = "List",
                ControllerName = "Comment",
                RouteValues = routeValues,
                SectionId = "comments"
            };

            return PartialView("ListPartial", model);
        }
Esempio n. 2
0
        public ActionResult Category(string category, int page = 1)
        {
            var pagedList = _entryRepository.GetByCategory(category).ToViewModelPagedList(e => e.ToViewModel(), page, _pageSize);

            var routeValues = new RouteValueDictionary();
            routeValues["category"] = category;

            var model = new ListViewModel
            {
                Caption = String.Format("Showing entries on category <strong>{0}</strong>. <a href='{1}'> Show all entries </a>", category, Url.Action("Entries", "Blog", new { page = 1 })),
                SectionId = "entries",
                Items = pagedList,
                PageTitle = String.Format("Category - {0}", category),
                TemplateName = "DisplayTemplates/EntryListItem",
                ActionName = "Category",
                ControllerName = "Blog",
                RouteValues = routeValues
            };

            return View("List", model);
        }
Esempio n. 3
0
        public ActionResult Categories(int page = 1)
        {
            var pagedList = (from category in _categoryRepository.GetAll()
                             orderby category.Name
                             select new CategoryViewModel
                             {
                                 Name = category.Name,
                                 EntryCount = category.Entries.Count
                             }).ToPagedList(page, _pageSize);

            var model = new ListViewModel
            {
                SectionId = "CategorieList",
                Items = pagedList,
                PageTitle = "Categories",
                TemplateName = "DisplayTemplates/CategoryListItem",
                ActionName = "Categories",
                ControllerName = "Blog"
            };

            return View("List", model);
        }
Esempio n. 4
0
        public ActionResult Tags(int page = 1)
        {
            var pagedList = (from tag in _tagRepository.GetAll()
                     orderby tag.Name
                     select new TagViewModel
                                {
                                    Name = tag.Name,
                                    EntryCount = tag.Entries.Count
                                }).ToPagedList(page, _pageSize);

            var model = new ListViewModel
            {
                SectionId = "TagList",
                Items = pagedList,
                PageTitle = "Tags",
                TemplateName = "DisplayTemplates/TagListItem",
                ActionName = "Tags",
                ControllerName = "Blog"
            };

            return View("List", model);
        }
Esempio n. 5
0
        public ActionResult Search(string term, int page = 1)
        {
            //TODO: implement full text search with Lucene.NET
            var pagedList = _entryRepository.Search(term).ToViewModelPagedList(e => e.ToViewModel(), page, _pageSize);

            var routeValues = new RouteValueDictionary();
            routeValues["term"] = term;

            var model = new ListViewModel
            {
                Caption = String.Format("Showing entries on search result for: <strong>{0}</strong>. <a href='{1}'> Show all entries </a>", term, Url.Action("Entries", "Blog", new { page = 1 })),
                SectionId = "entries",
                Items = pagedList,
                PageTitle = String.Format("Searching: \"{0}\"", term),
                TemplateName = "DisplayTemplates/EntryListItem",
                ActionName = "Search",
                ControllerName = "Blog",
                RouteValues = routeValues
            };

            return View("List", model);
        }
Esempio n. 6
0
        public ActionResult Entries(int page = 1)
        {
            var pagedList = _entryRepository.GetAll().ToViewModelPagedList(e => e.ToViewModel(), page, _pageSize);

            var model = new ListViewModel
                            {
                                SectionId = "entries",
                                Items = pagedList,
                                PageTitle = "Blog",
                                TemplateName = "DisplayTemplates/EntryListItem",
                                ActionName = "Entries",
                                ControllerName = "Blog"
                            };

            return View("List", model);
        }