/// <summary> /// Loads the by model. /// </summary> /// <param name="group">The group.</param> /// <returns></returns> public static GroupIndex LoadByModel(Group group) { var groupIndex = new GroupIndex(); groupIndex.SourceIndexModel = "Rock.Model.Group"; groupIndex.Id = group.Id; groupIndex.Name = group.Name; groupIndex.Description = group.Description; groupIndex.GroupTypeId = group.GroupTypeId; groupIndex.DocumentName = group.Name; groupIndex.ModelOrder = 5; if (group.GroupType != null) { groupIndex.IconCssClass = group.GroupType.IconCssClass; groupIndex.GroupTypeName = group.GroupType.Name; } if (group.Members != null) { groupIndex.MemberList = string.Join(", ", group.Members.Where(m => m.GroupRole.IsLeader != true).Select(m => m.Person.FullName)); groupIndex.LeaderList = string.Join(", ", group.Members.Where(m => m.GroupRole.IsLeader == true).Select(m => m.Person.FullName)); } AddIndexableAttributes(groupIndex, group); return(groupIndex); }
/// <summary> /// Loads the by model. /// </summary> /// <param name="group">The group.</param> /// <returns></returns> public static GroupIndex LoadByModel( Group group ) { var groupIndex = new GroupIndex(); groupIndex.SourceIndexModel = "Rock.Model.Group"; groupIndex.Id = group.Id; groupIndex.Name = group.Name; groupIndex.Description = group.Description; groupIndex.GroupTypeId = group.GroupTypeId; groupIndex.DocumentName = group.Name; groupIndex.ModelOrder = 5; if ( group.GroupType != null ) { groupIndex.IconCssClass = group.GroupType.IconCssClass; groupIndex.GroupTypeName = group.GroupType.Name; } if (group.Members != null ) { groupIndex.MemberList = string.Join( ", ", group.Members.Where( m => m.GroupRole.IsLeader != true ).Select( m => m.Person.FullName ) ); groupIndex.LeaderList = string.Join( ", ", group.Members.Where( m => m.GroupRole.IsLeader == true ).Select( m => m.Person.FullName ) ); } AddIndexableAttributes( groupIndex, group ); return groupIndex; }