Ejemplo n.º 1
0
        public IdentityResult Create(ApplicationUserStoreEntry user)
        {
            var users = GetUserCollection();

            if (users.Insert(user) != null)
            {
                return(IdentityResult.Success);
            }

            return(IdentityResult.Failed(new IdentityError {
                Description = $"Could not insert user {user.Email}."
            }));
        }
Ejemplo n.º 2
0
 public static ApplicationUser ToApplicationUser(this ApplicationUserStoreEntry storeEntry)
 {
     return(new ApplicationUser
     {
         Id = storeEntry.Id,
         UserName = storeEntry.UserName,
         Email = storeEntry.Email,
         EmailConfirmed = storeEntry.EmailConfirmed,
         PasswordHash = storeEntry.PasswordHash,
         NormalizedUserName = storeEntry.NormalizedUserName,
         AuthenticationType = storeEntry.AuthenticationType,
         IsAuthenticated = storeEntry.IsAuthenticated,
         Name = storeEntry.Name,
     });
 }
Ejemplo n.º 3
0
        public IdentityResult Update(ApplicationUserStoreEntry user)
        {
            var users = GetUserCollection();

            var storedUser = users.FindOne(u => u.Id == user.Id);

            storedUser.UserName           = user.UserName;
            storedUser.Email              = user.Email;
            storedUser.EmailConfirmed     = user.EmailConfirmed;
            storedUser.PasswordHash       = user.PasswordHash;
            storedUser.NormalizedUserName = user.NormalizedUserName;
            storedUser.AuthenticationType = user.AuthenticationType;
            storedUser.IsAuthenticated    = user.IsAuthenticated;
            storedUser.Name = user.Name;

            if (users.Update(user))
            {
                return(IdentityResult.Success);
            }
            return(IdentityResult.Failed(new IdentityError {
                Description = $"Could not update user {user.Email}."
            }));
        }