Exemple #1
0
        public static Identity GetUser(MembershipUser membership)
        {
            MailChimpMailingList ml   = new MailChimpMailingList();
            Identity             user = new Identity();
            var profile = ProfileBase.Create(membership.UserName);

            user.Email        = membership.UserName;
            user.IsApproved   = membership.IsApproved;
            user.IsLockedOut  = membership.IsLockedOut;
            user.FullName     = profile["FullName"] as string;
            user.UserId       = (Guid)membership.ProviderUserKey;
            user.IsSubscribed = ml.IsSubscribed(user);
            return(user);
        }
Exemple #2
0
        public void Save()
        {
            MailChimpMailingList ml = new MailChimpMailingList();
            var u       = Membership.GetUser(UserId);
            var profile = ProfileBase.Create(u.UserName);

            u.Email             = Email;
            u.IsApproved        = IsApproved;
            profile["FullName"] = FullName;
            profile.Save();
            if (IsSubscribed)
            {
                ml.Subscribe(this);
            }
            else
            {
                ml.Unsubscribe(this);
            }
            Membership.UpdateUser(u);
        }