private IEnumerable <BlogItemPageModel.TagItem> GetTags(BlogItemPage currentPage) { if (currentPage.Categories != null) { var allCategories = _contentLoader.GetItems(currentPage.Categories, CultureInfo.CurrentUICulture); return(allCategories. Select(cat => new BlogItemPageModel.TagItem() { Title = cat.Name, Url = _blogTagFactory.GetTagUrl(currentPage, cat.ContentLink), DisplayName = (cat as StandardCategory)?.Description, }).ToList()); } return(new List <BlogItemPageModel.TagItem>()); }
public IEnumerable <BlogItemPageModel.TagItem> GetTags(BlogItemPage currentPage) { List <BlogItemPageModel.TagItem> tags = new List <Models.ViewModels.BlogItemPageModel.TagItem>(); foreach (var item in currentPage.Category) { Category cat = Category.Find(item); tags.Add(new Models.ViewModels.BlogItemPageModel.TagItem() { Title = cat.Name, Url = TagFactory.Instance.GetTagUrl(currentPage, cat) }); } return(tags); }
public IEnumerable <BlogItemPageModel.TagItem> GetTags(BlogItemPage currentPage) { List <BlogItemPageModel.TagItem> tags = new List <BlogItemPageModel.TagItem>(); var categoryRepository = ServiceLocator.Current.GetInstance <CategoryRepository>(); foreach (var item in currentPage.Category) { Category cat = categoryRepository.Get(item); tags.Add(new BlogItemPageModel.TagItem() { Title = cat.Name, Url = TagFactory.Instance.GetTagUrl(currentPage, cat) }); } return(tags); }
public ActionResult Full(BlogItemPage currentPage) { PreviewTextLength = 200; var model = new BlogItemPageModel(currentPage) { Category = currentPage.Category, Tags = GetTags(currentPage), PreviewText = GetPreviewText(currentPage), MainBody = currentPage.MainBody, StartPublish = currentPage.StartPublish.Value }; var editHints = ViewData.GetEditHints <BlogItemPageModel, BlogItemPage>(); editHints.AddConnection(m => m.Category, p => p.Category); editHints.AddFullRefreshFor(p => p.Category); editHints.AddFullRefreshFor(p => p.StartPublish); return(PartialView("Full", model)); }