如何使用 DNN 从 ContentType 获取 ContentItems?
How do I get ContentItems from ContentType using DNN?
我想 select Fruits contentType 的所有 contentItems 并将它们存储到一个数组中以便于访问。
public array GetFruitNutrition(int itemId)
{
array fruitsArray = DotNetNuke.Entities.Content.Data.DataService.GetContentItemsByContentType(Fruits);
return fruitsArray[itemId].Nutrition;
}
有什么办法可以做到这一点吗?我也接受其他选择。
使用 DotNetNuke.Entities.Content.ContentController.GetContentItemsByContentType
而不是直接转到数据服务。
ContentType contentType = new ContentTypeController().GetContentTypes().SingleOrDefault(ct => ct.ContentType == "MyCompany_Fruit");
ContentItem[] fruit = new ContentController().GetContentItemsByContentType(contentType.ContentTypeId).ToArray();
我想 select Fruits contentType 的所有 contentItems 并将它们存储到一个数组中以便于访问。
public array GetFruitNutrition(int itemId)
{
array fruitsArray = DotNetNuke.Entities.Content.Data.DataService.GetContentItemsByContentType(Fruits);
return fruitsArray[itemId].Nutrition;
}
有什么办法可以做到这一点吗?我也接受其他选择。
使用 DotNetNuke.Entities.Content.ContentController.GetContentItemsByContentType
而不是直接转到数据服务。
ContentType contentType = new ContentTypeController().GetContentTypes().SingleOrDefault(ct => ct.ContentType == "MyCompany_Fruit");
ContentItem[] fruit = new ContentController().GetContentItemsByContentType(contentType.ContentTypeId).ToArray();