コード例 #1
0
        public IActionResult Signup(CustomerSignupViewModel signupModel)
        {
            if (ModelState.IsValid)
            {
                eCommerce.AddCustomer(signupModel.Customer, out ICollection <string> errors);
                if (errors.Any())
                {
                    ViewData[GlobalViewBagKeys.Errors] = errors;
                }
                else
                {
                    ICollection <string> messages = new List <string>();
                    messages.Add($"Sign up succeed with email {signupModel.Customer.Email}");
                    ViewData[GlobalViewBagKeys.Messages] = messages;

                    return(Redirect(signupModel.ReturnUrl));
                }
            }
            return(View(signupModel));
        }