コード例 #1
0
        public IActionResult Signup(SellerSignupViewModel signupModel)
        {
            if (ModelState.IsValid)
            {
                eCommerce.AddSeller(new SellerAddModel
                {
                    Name        = signupModel.Seller.Name,
                    Email       = signupModel.Seller.Email,
                    PhoneNumber = signupModel.Seller.PhoneNumber,
                    Password    = signupModel.Seller.Password
                }, 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.Seller.Email}");
                    ViewData[GlobalViewBagKeys.Messages] = messages;

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