public MembershipUser CreateUser(string username, string password, string email) { User u = new User(); u.UserName = username; u.Email = email; u.PasswordSalt = UserDAL.CreateSalt(); u.Password = UserDAL.CreatePasswordHash(password, u.PasswordSalt); db.AddToUsers(u); db.SaveChanges(); return CreateMembershipUser(u.UserName); }
/// <summary> /// Creates new User /// </summary> /// <param name="username">The username.</param> /// <param name="password">The password.</param> /// <param name="email">The email.</param> /// <param name="firstName">The first name.</param> /// <param name="lastName">The last name.</param> /// <returns>The newly created User</returns> public static User Create(string username, string password, string email, string firstName, string lastName) { User u = new User(); u.UserName = username; u.Email = email; u.FirstName = firstName; u.LastName = lastName; u.PasswordSalt = CreateSalt(); u.Password = CreatePasswordHash(password, u.PasswordSalt); db.AddToUsers(u); db.SaveChanges(); return u; }
/// <summary> /// Deprecated Method for adding a new object to the Users EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToUsers(User user) { base.AddObject("Users", user); }
/// <summary> /// Create a new User object. /// </summary> /// <param name="id">Initial value of the ID property.</param> /// <param name="userName">Initial value of the UserName property.</param> /// <param name="password">Initial value of the Password property.</param> /// <param name="passwordSalt">Initial value of the PasswordSalt property.</param> /// <param name="email">Initial value of the Email property.</param> public static User CreateUser(global::System.Int32 id, global::System.String userName, global::System.String password, global::System.String passwordSalt, global::System.String email) { User user = new User(); user.ID = id; user.UserName = userName; user.Password = password; user.PasswordSalt = passwordSalt; user.Email = email; return user; }