Пример #1
0
        public IActionResult Registration(RegisterViewModel registerViewModel)
        {
            if (!_peopleRepository.IsUniqueLogin(registerViewModel.Login, registerViewModel.Email))
            {
                ModelState.AddModelError("", "Логин или Email уже занят!");
            }

            if (ModelState.IsValid)
            {
                _peopleRepository.AddHuman(registerViewModel.Login, registerViewModel.Email, Encryption.Encryption.GetHash(registerViewModel.Password), registerViewModel.Name,
                                           registerViewModel.Surname, registerViewModel.MiddleName, registerViewModel.PhoneNumber, 3);
                return(RedirectToAction("Phone", "Market"));
            }

            return(View(registerViewModel));
        }