protected Customer CreateCustomer(CreateCustomerCommand request) { var firstName = request.FirstName; var lastName = request.LastName; return(_customerFactory.CreateCustomer(firstName, lastName)); }
public Customer CreateCustomer(string name) { var customer = _customerFactory.CreateCustomer(name); customer.Bank = this; _customers.Add(customer); return(customer); }
private void HandleUserCreation(CheckoutViewModel model, OrderAddress billingAddress, OrderAddress shippingAddress, string username) { // has specified password if (!User.Identity.IsAuthenticated && !string.IsNullOrEmpty(model.Password)) { // check if email exists var user = Membership.GetUser(username); if (user != null) { // user exists if (Membership.ValidateUser(username, model.Password)) { // cannot login here because something strange happens with the order //LoginController.CreateAuthenticationCookie(ControllerContext.HttpContext, username, AppContext.Current.ApplicationName, false); } else { ModelState.AddModelError("Password", _localizationService.GetString("/common/account/login_error")); } } else { // create new customer var customer = _customerFactory.CreateCustomer(username, model.Password, model.Phone, billingAddress, shippingAddress, true, createStatus => { switch (createStatus) { case MembershipCreateStatus.DuplicateUserName: ModelState.AddModelError("Password", _localizationService.GetString("/common/account/register_error_unique_username")); break; case MembershipCreateStatus.InvalidPassword: ModelState.AddModelError("Password", _localizationService.GetString("/common/account/register_error")); break; default: ModelState.AddModelError("Password", createStatus.ToString()); break; } }); if (customer != null) { // customer was created // cannot login here because something strange happens with the order // TODO: Investigate this //LoginController.CreateAuthenticationCookie(ControllerContext.HttpContext, username, AppContext.Current.ApplicationName, false); } } } }
protected CustomerContact CreateCustomer(string email, string password, string phone, OrderAddress billingAddress, OrderAddress shippingAddress, bool hasPassword, Action <MembershipCreateStatus> userCreationFailed) { return(_customerFactory.CreateCustomer(email, password, phone, billingAddress, shippingAddress, hasPassword, userCreationFailed)); }
public CustomerAccounts(ICustomerFactory cust, IAccountFactory acc) { this._customer = cust.CreateCustomer(); this._accounts = new List <AccountControler>(); this._accounts.Add(new AccountControler(acc)); }