Esempio n. 1
0
        public IActionResult Register(RegisterViewModel register)
        {
            if (!ModelState.IsValid)
            {
                return(View(register));
            }
            CheckUser checkUser = _userService.CheckUser(register.UserName, register.Email);

            if (checkUser != CheckUser.Ok)
            {
                ViewBag.Check = checkUser;
                return(View(register));
            }
            Domain.Models.User user = new Domain.Models.User()
            {
                Email    = register.Email.Trim().ToLower(),
                Password = PasswordHelper.EncodePasswordMd5(register.Password),
                UserName = register.UserName
            };
            _userService.RegisterUser(user);
            return(View("SuccessRegister", register));
        }