public override IEnumerable<DynamicNode> GetDynamicNodeCollection(ISiteMapNode node) { // Build value var returnValue = new List<DynamicNode>(); // Create a node for each Arrticle foreach (var article in _newServices.GetAll()) { T_News_TagServices newsTagServies = new T_News_TagServices(); IEnumerable<T_Tag> TagList = newsTagServies.GetTagByNewsID(article.ID, TNVTH.Web.Utilities.Constants.TAXONOMY_TAG); string TagString = ""; foreach (var tag in TagList) { TagString += tag.Title; TagString += ", "; } DynamicNode dynamicNode = new DynamicNode(); dynamicNode.Title = article.Title; dynamicNode.RouteValues.Add("id", article.ID); dynamicNode.RouteValues.Add("slug", article.Slug); dynamicNode.PreservedRouteParameters = new List<string> { article.Slug }; string Description = Utilities.Common.GetDescription(article.ContentNews, 50); dynamicNode.Description = (Description== null)? article.Title: Description; dynamicNode.Attributes.Add("keywords", TagString); dynamicNode.Attributes.Add("og:image", "http://" + HttpContext.Current.Request.Url.Host + article.AvataImageUrl); dynamicNode.Attributes.Add("type", "article"); dynamicNode.Attributes.Add("author", article.Author); T_Tag NewsCate = _newServices.GetCateByNewsID(article.ID); if (NewsCate != null) { dynamicNode.ParentKey = "NewsCate" + NewsCate.ID; } returnValue.Add(dynamicNode); } // Return return returnValue; }
public PartialViewResult GetTags(int id, string taxonomy) { T_News_TagServices _news_TagServices = new T_News_TagServices(); IEnumerable<T_Tag> TagList = _news_TagServices.GetTagByNewsID(id, taxonomy); return PartialView(TagList); }
public PartialViewResult GetCategoryLink(int id) { T_News_TagServices _news_TagServices = new T_News_TagServices(); IEnumerable<T_Tag> TagList = _news_TagServices.GetTagByNewsID(id, TNVTH.Web.Utilities.Constants.TAXONOMY_CATEGORY); return PartialView(TagList); }