Beispiel #1
0
 public PageOfPostViewModel(ConfigurationViewModel configViewModel, LayoutViewModel layoutViewModel, PostViewModel postViewModel)
 {
     Configuration = configViewModel;
     Layout = layoutViewModel;
     Post = postViewModel;
 }
Beispiel #2
0
        private ActionResult GetPost(string url)
        {
            var config = ConfigRepository.Read(ConfigPath);
            var configViewModel = new ConfigurationViewModel(config);

            var postSearchCriteria = new FrontMatterSearchCriteria(1, 0, Order.Descending, PostPath, FrontMatterSearchCriteria.DefaultFrom, FrontMatterSearchCriteria.DefaultTo, url, true);
            var pageOfPost = FrontMatterRepository.Get(postSearchCriteria);
            var post = pageOfPost.Entities.First();
            var postViewModel = new PostViewModel(post, MarkupProcessorFactory);

            var layoutPath = GetLayoutPath(post.Layout);
            var layout = LayoutParser.Parse(layoutPath);
            var layoutViewModel = new LayoutViewModel(layout);

            var pageOfPostViewModel = new PageOfPostViewModel(configViewModel, layoutViewModel, postViewModel);

            return View("Post", pageOfPostViewModel);
        }