Ejemplo n.º 1
0
 public static ClientMembershipUser ToClientMembershipUser(ClientMembershipUserContract contract)
 {
     ClientMembershipUser user = null;
     if (user != null)
     {
         user = new ClientMembershipUser(new User(contract.UserKey,
             contract.UserName, contract.Email, contract.PasswordQuestion,
             contract.IsLockedOut, contract.CreationDate, contract.LastLoginDate,
             contract.LastActivityDate, contract.LastPasswordChangedDate,
             contract.LastLockoutDate), contract.PasswordSalt, 
             Converter.ToPasswordFormat(contract.PasswordFormat),
             contract.FailedPasswordAttemptCount,
             contract.FailedPasswordAttemptWindowStart,
             contract.FailedPasswordAnswerAttemptCount,
             contract.FailedPasswordAnswerAttemptWindowStart);
         foreach (RoleContract role in contract.Roles)
         {
             user.Roles.Add(Converter.ToRole(role));
         }
     }
     return user;
 }
Ejemplo n.º 2
0
 public static ClientMembershipUserContract ToClientMembershipUserContract(ClientMembershipUser user)
 {
     ClientMembershipUserContract contract = null;
     if (user != null)
     {
         contract = new ClientMembershipUserContract();
         contract.CreationDate = user.CreationDate;
         contract.Email = user.Email;
         contract.FailedPasswordAnswerAttemptCount = user.FailedPasswordAnswerAttemptCount;
         contract.FailedPasswordAnswerAttemptWindowStart = user.FailedPasswordAnswerAttemptWindowStart;
         contract.FailedPasswordAttemptCount = user.FailedPasswordAttemptCount;
         contract.FailedPasswordAttemptWindowStart = user.FailedPasswordAttemptWindowStart;
         contract.IsLockedOut = user.IsLockedOut;
         contract.Key = user.Key;
         contract.LastActivityDate = user.LastActivityDate;
         contract.LastLockoutDate = user.LastLockoutDate;
         contract.LastLoginDate = user.LastLoginDate;
         contract.LastPasswordChangedDate = user.LastPasswordChangedDate;
         contract.PasswordFormat = Converter.ToPasswordFormatContract(user.PasswordFormat);
         contract.PasswordQuestion = user.PasswordQuestion;
         contract.PasswordSalt = user.PasswordSalt;
         foreach (Role role in user.Roles)
         {
             contract.Roles.Add(Converter.ToRoleContract(role));
         }
         contract.UserKey = user.UserKey;
         contract.UserName = user.UserName;
     }
     return contract;
 }