Esempio n. 1
0
        public async Task <IActionResult> Registration(RegistrationViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                return(View(viewModel));
            }

            if (await manageUser.ExistsUserAsync(viewModel.Email))
            {
                ModelState.AddModelError("", "Данная почта уже зарегестрирована");
                return(View(viewModel));
            }
            else
            {
                await manageUser.AddCustomerAsync(viewModel.FormUser(), viewModel.FormCustomerInfo());
                await Authenticate(viewModel.Email, "Customer");

                return(RedirectToAction("Index", "Home"));
            }
        }