Exemplo n.º 1
0
        private void Convert(AspNetMembershipUser from, AspNetUser to)
        {
            AspNetApplication application = _dbcontext.AspNetApplications.First();

            to.ApplicationId     = application.ApplicationId;
            to.AspNetApplication = application;
            to.AspNetMembership  = new AspNetMembership
            {
                ApplicationId     = application.ApplicationId,
                AspNetApplication = application
            };

            to.UserId                                   = Guid.Parse(from.Id);
            to.UserName                                 = from.UserName;
            to.LoweredUserName                          = from.UserName.ToLower();
            to.LastActivityDate                         = DateTime.UtcNow;
            to.IsAnonymous                              = false;
            to.ApplicationId                            = application.ApplicationId;
            to.AspNetMembership.CreateDate              = DateTime.UtcNow;
            to.AspNetMembership.Email                   = from.Email;
            to.AspNetMembership.IsApproved              = true;
            to.AspNetMembership.LastLoginDate           = DateTime.Parse("1754-01-01 00:00:00.000");
            to.AspNetMembership.LastLockoutDate         = DateTime.Parse("1754-01-01 00:00:00.000");
            to.AspNetMembership.LastPasswordChangedDate = DateTime.Parse("1754-01-01 00:00:00.000");
            to.AspNetMembership.LoweredEmail            = from.NormalizedEmail.ToLower();
            to.AspNetMembership.Password                = from.PasswordHash;
            to.AspNetMembership.PasswordSalt            = from.PasswordSalt;
            to.AspNetMembership.PasswordFormat          = from.PasswordFormat;
            to.AspNetMembership.IsLockedOut             = false;
            to.AspNetMembership.FailedPasswordAnswerAttemptWindowStart = DateTime.Parse("1754-01-01 00:00:00.000");
            to.AspNetMembership.FailedPasswordAttemptWindowStart       = DateTime.Parse("1754-01-01 00:00:00.000");
        }
Exemplo n.º 2
0
        private AspNetRole Convert(AspNetMembershipRole role)
        {
            AspNetApplication application = _dbcontext.AspNetApplications.First();

            return(new AspNetRole
            {
                ApplicationId = application.ApplicationId,
                RoleId = role.Id,
                RoleName = role.Name,
                LoweredRoleName = role.NormalizedName.ToLower()
            });
        }