I'm using Web API's to perform some customized stuff in nopCommerce (asset mgmt. of sold goods). The Web API methods receive information from an Android/IoS app. The app has the possibility to create a new user (customer in nop) and therefore I need to do some upfront checking: is the email already in use, does the customer exist,...:
var cust = _customerService.GetCustomerByEmail(email);
if (cust != null)
return EEPC_BadRequest("Email is already registered");
When executing this call, the 'Guest account' is created. I've tried to set the _workContext.CurrentCustomer to the build-in SearchEngine account like so:
_workContext.CurrentCustomer = _customerService.GetCustomerBySystemName(SystemCustomerNames.SearchEngine);
However I guess that even the GetCustomerBySystemName() call will generate the Guest account.
So I try to set the _workContext.CurrentCustomer variables individually like so:
_workContext.CurrentCustomer.Active = true;
_workContext.CurrentCustomer.CustomerGuid = new Guid("0f806806-7a1d-4780-b5a6-320ca123c842");
_workContext.CurrentCustomer.Id = 2;
_workContext.CurrentCustomer.Email = "[email protected]
_workContext.CurrentCustomer.IsSystemAccount = true;
_workContext.CurrentCustomer.PasswordFormatId = 0;
_workContext.CurrentCustomer.SystemName = SystemCustomerNames.SearchEngine;
_workContext.CurrentCustomer.Username = null;
_workContext.CurrentCustomer.VendorId = 0;
and make the call to GetCustomerByEmail(email), still the guest account gets created.
So simple question: How can I avoid the 'Guest' account gets created in my WebAPI method?
tx for the help!