Attributes group by category
示例#1
0
        private static void AddAttributeCategory(List <AttributeCategory> attributeCategories, Rock.Web.Cache.CategoryCache category, Rock.Web.Cache.AttributeCache attribute)
        {
            AttributeCategory attributeCategory = null;

            if (category != null)
            {
                attributeCategory = attributeCategories.Where(g => g.Category != null && g.Category.Id == category.Id).FirstOrDefault();
            }
            else
            {
                attributeCategory = attributeCategories.Where(g => g.Category == null).FirstOrDefault();
            }

            if (attributeCategory == null)
            {
                attributeCategory            = new AttributeCategory();
                attributeCategory.Category   = category;
                attributeCategory.Attributes = new List <Web.Cache.AttributeCache>();
                attributeCategories.Add(attributeCategory);
            }

            attributeCategory.Attributes.Add(attribute);
        }
示例#2
0
        private static void AddAttributeCategory( List<AttributeCategory> attributeCategories, Rock.Web.Cache.CategoryCache category, Rock.Web.Cache.AttributeCache attribute )
        {
            AttributeCategory attributeCategory = null;
            if ( category != null )
            {
                attributeCategory = attributeCategories.Where( g => g.Category != null && g.Category.Id == category.Id ).FirstOrDefault();
            }
            else
            {
                attributeCategory = attributeCategories.Where( g => g.Category == null ).FirstOrDefault();
            }

            if ( attributeCategory == null )
            {
                attributeCategory = new AttributeCategory();
                attributeCategory.Category = category;
                attributeCategory.Attributes = new List<Web.Cache.AttributeCache>();
                attributeCategories.Add( attributeCategory );
            }

            attributeCategory.Attributes.Add( attribute );
        }