示例#1
0
        public static string UnBlockMember(int memberId)
        {
            int _currentMember = HttpContext.Current.User.Identity.IsAuthenticated ? (int)Membership.GetUser().ProviderUserKey : 0;

            //Check if member is an admin (in group 'admin')
            if (Utills.IsAdmin(_currentMember))
            {
                //Lets check the memberID of the member we are blocking passed into /base is a valid member..
                if (Utills.IsMember(memberId))
                {
                    //Yep - it's valid, lets get that member
                    Member MemberToBlock = Utills.GetMember(memberId);

                    //Now we have the member - lets update the 'blocked' property on the member
                    MemberToBlock.getProperty("blocked").Value = false;

                    //Save the changes
                    MemberToBlock.Save();

                    //It's all good...
                    return("true");
                }
            }

            //Member not authorised or memberID passed in is not valid
            return("false");
        }