コード例 #1
0
        public ActionResult Register(RegisterCustomerViewModel model)
        {
            var viewModel = new RegisterCustomerViewModel();
            var customer  = mapper.Map <RegisterCustomerViewModel, Customer>(model);

            var returnStatus = customerAccountService.CreateCustomer(customer);

            if (returnStatus == MembershipCreateStatus.Success)
            {
                var customerData = mapper.Map <RegisterCustomerViewModel, Customer>(model);
                mailer.NewCustomer(customer).Send();
                authentication.Signin(customer.Email, customerData);
                return(RedirectToAction("ThankYouForJoining"));
            }
            viewModel.HasError     = true;
            viewModel.CreateStatus = new CustomerCreationError(returnStatus);
            return(View(viewModel));
        }