public ActionResult ViewPage(string pageSlug)
        {
            var pageFactory = new PageFactory(this.session);
            var page = pageFactory.CreateFromSlug(pageSlug);
            if (page == null)
            {
                return new HttpNotFoundResult("No such page.");
            }

            var pageToPageViewModelMapper = new PageToPageViewModelMapper(this.session, this.Url);
            var pageViewModel = pageToPageViewModelMapper.Map(page);

            return this.View(pageViewModel);
        }
        public ActionResult ViewEntry(string pageSlug, string entrySlug)
        {
            var pageFactory = new PageFactory(this.session);
            var page = pageFactory.CreateFromSlug(pageSlug);
            if (page == null)
            {
                return new HttpNotFoundResult("No such page.");
            }

            var entryFactory = new EntryFactory(this.session);
            var entry = entryFactory.CreateFromSlug(entrySlug);
            if (entry == null)
            {
                return new HttpNotFoundResult("No such entry.");
            }

            var entryToEntryViewModelMapper = new EntryToEntryViewModelMapper(this.session, this.Url);
            var entryViewModel = entryToEntryViewModelMapper.Map(entry);

            entryViewModel.PageSlug = pageSlug;

            return this.View(entryViewModel);
        }
 private static Page GetPageForSlug(IDocumentSession session, string slug)
 {
     var pageFactory = new PageFactory(session);
     return pageFactory.CreateFromSlug(slug);
 }