c# Create accounts in AspDotNetStorefront using custom code

121 Views Asked by At

How can i create an account in AspDotNetStorefront 9.5 using c# custom code? I am trying to add customer without using the registration form.Is there is any service our custom code i can use?

1

There are 1 best solutions below

0
dubloons On

If you look through the source most of the time customers are created by entering data into the Customer table directly. The reason is that the Customer class assumes sessions, which are a bit tricky to fake and/or get around in ASPDNSF.

I think, however, that this should work:

Customer c = new Customer(true);
c.RequireCustomerRecord();
c.UpdateCustomer(...);

The Customer constructor with a boolean value of true suppresses cookies, which is very important. (This code needs testing - I've never tried it.)

Alternately you could just create the customer with direct SQL: INSERT INTO Customer (...) VALUES (...). This is common practice in ASPDNSF.