public static string Get_tag_link(string[] tags) { List <Tags> ItemData = new List <Tags>(); ItemData = DbHandle.Get_tag_list(tags); string result = ""; foreach (var s in ItemData) { result += result == "" ? "" : "/"; result += s.Name; } return(result); }
public static string Get_category_link(int id, int num = 0, string cid = "") { List <Category> ItemData = new List <Category>(); ItemData = (List <Category>)DbHandle.Get_article_category(id); string result = ""; int i = 0; foreach (var s in ItemData) { if (i > num && num != 0) { result = " <a href = \"/catalog/" + s.CategoryId.ToString() + "\" class=\"post-category\">" + s.Name + "</a>"; } else { result += " <a href = \"/catalog/" + s.CategoryId.ToString() + "\" class=\"post-category\">" + s.Name + "</a>"; } } if (cid != "") { var s = ItemData.Find(p => p.CategoryId == int.Parse(cid)); if (s != null) { if (s.Parentid == 0 && ItemData.Find(p => p.Parentid == int.Parse(cid)) != null) { s = ItemData.Find(p => p.Parentid == int.Parse(cid)); } result = " <a href = \"/catalog/" + s.CategoryId.ToString() + "\" class=\"post-category\">" + s.Name + "</a>"; } } return(result); }