public ActionResult Atom() { var config = ConfigRepository.Read(ConfigPath); var configViewModel = new ConfigurationViewModel(config); var postSearchCriteria = new FrontMatterSearchCriteria(10, 0, Order.Descending, PostPath, FrontMatterSearchCriteria.DefaultFrom, FrontMatterSearchCriteria.DefaultTo, string.Empty, true); var pageOfPosts = FrontMatterRepository.Get(postSearchCriteria); var pageOfPostsViewModel = new PageOfPostsViewModel(pageOfPosts, MarkupProcessorFactory); var layoutViewModel = new LayoutViewModel(); var homeViewModel = new HomeViewModel(configViewModel, layoutViewModel, pageOfPostsViewModel); return new AtomViewResult(homeViewModel); }
public ActionResult Get(int limit = 10, int offset = 0) { var config = ConfigRepository.Read(ConfigPath); var configViewModel = new ConfigurationViewModel(config); var searchCriteria = new FrontMatterSearchCriteria(limit, offset, Domain.Common.Order.Descending, PostPath, FrontMatterSearchCriteria.DefaultFrom, FrontMatterSearchCriteria.DefaultTo, string.Empty, true); var pageOfPosts = FrontMatterRepository.Get(searchCriteria); var pageOfPostViewModel = new PageOfPostsViewModel(pageOfPosts, MarkupProcessorFactory); var layoutPath = GetLayoutPath("home"); var layout = LayoutParser.Parse(layoutPath); var layoutViewModel = new LayoutViewModel(layout); var homeViewModel = new HomeViewModel(configViewModel, layoutViewModel, pageOfPostViewModel); return View(homeViewModel); }
public PageOfPostViewModel(ConfigurationViewModel configViewModel, LayoutViewModel layoutViewModel, PostViewModel postViewModel) { Configuration = configViewModel; Layout = layoutViewModel; Post = postViewModel; }
public PageOfContentViewModel(ConfigurationViewModel configViewModel, LayoutViewModel layoutViewModel, ContentViewModel frontMatterContentViewModel) { Configuration = configViewModel; Layout = layoutViewModel; FrontMatterContent = frontMatterContentViewModel; }
public HomeViewModel(ConfigurationViewModel configViewModel, LayoutViewModel layoutViewModel, PageOfPostsViewModel pageOfPostViewModel) { Configuration = configViewModel; Layout = layoutViewModel; Posts = pageOfPostViewModel; }
public static string FormatDate(this HtmlHelper helper, ConfigurationViewModel configViewModel, DateTimeOffset dateTime) { try { return dateTime.ToString(configViewModel.DateFormat); } catch { return dateTime.ToString("g"); // format: 3/9/2008 4:05 PM } }
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); }
private ActionResult GetPage(string url) { var config = ConfigRepository.Read(ConfigPath); var configViewModel = new ConfigurationViewModel(config); var searchCriteria = new FrontMatterSearchCriteria(1, 0, Order.Ascending, SitePath, null, null, url, true); var pageOfPages = FrontMatterRepository.Get(searchCriteria); var frontMatter = pageOfPages.Entities.First(); var frontMatterContentViewModel = new ContentViewModel(frontMatter, MarkupProcessorFactory); var layoutPath = GetLayoutPath(frontMatter.Layout); var layout = LayoutParser.Parse(layoutPath); var layoutViewModel = new LayoutViewModel(layout); var pageOfFrontMatterContentViewModel = new PageOfContentViewModel(configViewModel, layoutViewModel, frontMatterContentViewModel); return View("Default", pageOfFrontMatterContentViewModel); }