Attributes group by category
コード例 #1
0
ファイル: Helper.cs プロジェクト: scotthenry76/Rock-CentralAZ
        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
ファイル: Helper.cs プロジェクト: tcavaletto/Rock-CentralAZ
        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 );
        }