本文整理汇总了C#中IArticleService.GetArticleGroupById方法的典型用法代码示例。如果您正苦于以下问题:C# IArticleService.GetArticleGroupById方法的具体用法?C# IArticleService.GetArticleGroupById怎么用?C# IArticleService.GetArticleGroupById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IArticleService
的用法示例。
在下文中一共展示了IArticleService.GetArticleGroupById方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetFormattedBreadCrumb
public static string GetFormattedBreadCrumb(this ArticleGroup category,
IArticleService articleService,
string separator = ">>")
{
if (category == null)
throw new ArgumentNullException("category");
string result = string.Empty;
//used to prevent circular references
var alreadyProcessedArticleGroupIds = new List<int>() { };
while (category != null && //not null
!category.Deleted && //not deleted
!alreadyProcessedArticleGroupIds.Contains(category.Id)) //prevent circular references
{
if (String.IsNullOrEmpty(result))
{
result = category.Name;
}
else
{
result = string.Format("{0} {1} {2}", category.Name, separator, result);
}
alreadyProcessedArticleGroupIds.Add(category.Id);
category = articleService.GetArticleGroupById(category.ParentGroupId);
}
return result;
}
示例2: GetArticleGroupBreadCrumb
public static IList<ArticleGroup> GetArticleGroupBreadCrumb(this ArticleGroup articleGroup,
IArticleService articleService,
bool showHidden = false)
{
if (articleGroup == null)
throw new ArgumentNullException("articleGroup");
var result = new List<ArticleGroup>();
//used to prevent circular references
var alreadyProcessedArticleGroupIds = new List<int>() { };
while (articleGroup != null && //not null
!articleGroup.Deleted && //not deleted
(showHidden || articleGroup.Published) && //published
!alreadyProcessedArticleGroupIds.Contains(articleGroup.Id)) //prevent circular references
{
result.Add(articleGroup);
alreadyProcessedArticleGroupIds.Add(articleGroup.Id);
articleGroup = articleService.GetArticleGroupById(articleGroup.ParentGroupId);
}
result.Reverse();
return result;
}