Esempio n. 1
0
        private BlogItemPageViewModel GetBlogItemPageViewModel(PageData currentPage, BlogListPageViewModel blogModel)
        {
            var pd = (BlogItemPage.BlogItemPage)currentPage;

            PreviewTextLength = 200;

            var model = new BlogItemPageViewModel(pd)
            {
                Tags             = GetTags(pd),
                PreviewText      = GetPreviewText(pd),
                ShowIntroduction = blogModel.ShowIntroduction,
                ShowPublishDate  = blogModel.ShowPublishDate,
                Template         = blogModel.CurrentContent.Template,
                PreviewOption    = blogModel.CurrentContent.PreviewOption,
                StartPublish     = currentPage.StartPublish ?? DateTime.UtcNow
            };

            return(model);
        }
Esempio n. 2
0
        public IActionResult Index(Models.BlogItemPage currentPage)
        {
            PreviewTextLength = 200;

            var model = new BlogItemPageViewModel(currentPage)
            {
                Category     = currentPage.Category,
                Tags         = /*GetTags(currentPage)*/ new List <TagItem>(),
                PreviewText  = GetPreviewText(currentPage),
                MainBody     = currentPage.MainBody,
                StartPublish = currentPage.StartPublish ?? DateTime.UtcNow,
                BreadCrumbs  = GetBreadCrumb(currentPage)
            };

            var editHints = ViewData.GetEditHints <ContentViewModel <Models.BlogItemPage>, Models.BlogItemPage>();

            editHints.AddConnection(m => m.CurrentContent.Category, p => p.Category);
            editHints.AddConnection(m => m.CurrentContent.StartPublish, p => p.StartPublish);

            return(View(model));
        }