Rock.Model.GroupMemberService.Get C# (CSharp) Method

Get() public method

Gets the specified unique identifier.
public Get ( System.Guid guid ) : GroupMember
guid System.Guid The unique identifier.
return GroupMember
        public override GroupMember Get( Guid guid )
        {
            return this.Queryable( true ).FirstOrDefault( m => m.Guid == guid );
        }

Same methods

GroupMemberService::Get ( int id ) : GroupMember

Usage Example

Exemplo n.º 1
0
        /// <summary>
        /// Determines whether this is a new group member (just added) or if either Person or Role is different than what is stored in the database
        /// </summary>
        /// <param name="rockContext">The rock context.</param>
        /// <returns></returns>
        public bool IsNewOrChangedGroupMember(RockContext rockContext)
        {
            if (this.Id == 0)
            {
                // new group member
                return(true);
            }
            else
            {
                var groupMemberService        = new GroupMemberService(rockContext);
                var databaseGroupMemberRecord = groupMemberService.Get(this.Id);

                // existing groupmember record, but person or role was changed
                var hasChanged = this.PersonId != databaseGroupMemberRecord.PersonId || this.GroupRoleId != databaseGroupMemberRecord.GroupRoleId;

                if (!hasChanged)
                {
                    var entry = rockContext.Entry(this);
                    if (entry != null)
                    {
                        hasChanged = rockContext.Entry(this).Property("PersonId")?.IsModified == true || rockContext.Entry(this).Property("GroupRoleId")?.IsModified == true;
                    }
                }

                return(hasChanged);
            }
        }
All Usage Examples Of Rock.Model.GroupMemberService::Get