Пример #1
0
        public IEnumerable <ContentTypeDescriptor> Expand(string typeOrGroupIdOrTypeName)
        {
            var contentType = ContentTypeProvider.Get(typeOrGroupIdOrTypeName);

            if (contentType != null)
            {
                return(new List <ContentTypeDescriptor> {
                    contentType
                }.AsReadOnly());
            }

            var contentTypeGroup = ContentTypeGroupProvider.Get(typeOrGroupIdOrTypeName);

            if (contentTypeGroup != null)
            {
                return(ContentTypeGroupMatcher.GetContentTypesFor(contentTypeGroup.Id));
            }

            var contentTypesByTypeName = ContentTypeProvider.GetAll().Where(t => t.Type.Name == typeOrGroupIdOrTypeName || t.Type.GetInterfaces().Any(i => i.Name == typeOrGroupIdOrTypeName)).ToList().AsReadOnly();

            if (contentTypesByTypeName.Any())
            {
                return(contentTypesByTypeName);
            }

            return(null);
        }
Пример #2
0
        public IEnumerable <ContentTypeGroupResponseItem> GetContentTypeGroupList()
        {
            var result = new List <ContentTypeGroupResponseItem>();

            foreach (var contentType in ContentTypeGroupProvider.GetAll())
            {
                result.Add(GetItem(contentType));
            }

            return(result.AsReadOnly());
        }