public void CreateUser(string username, string password) { const int bcryptWorkFactor = 10; var hashedPassword = BCrypt.Net.BCrypt.HashPassword(password, bcryptWorkFactor); var golduser = new User {Username = username, Password = hashedPassword}; var collection = _mongoDatabase.GetCollection<User>("Users"); collection.Insert(golduser); }
public string CreateUserAndAccount(string username, string password, IDictionary<string, object> values) { const int bcryptWorkFactor = 10; var hashedPassword = BCrypt.Net.BCrypt.HashPassword(password, bcryptWorkFactor); var user = new User { Username = username, Password = hashedPassword, Email = values["Email"].ToString(), FirstName = values["FirstName"].ToString(), LastName = values["LastName"].ToString() }; var collection = _mongoDatabase.GetCollection<User>("Users"); collection.Insert(user); return user._id.ToString(); }