Beispiel #1
0
        public IActionResult SignUp(User u, string Password)
        {
            QuestionRepository qr = new QuestionRepository(_connectionString);

            qr.AddUser(u, Password);
            return(Redirect("/Account/Login"));
        }
        public IActionResult Signup(User u)
        {
            var db   = new QuestionRepository(_conn);
            var user = db.GetUserByEmail(u.Email);

            if (user != null) //email already exists
            {
                TempData["Message"] = "Email already used by another user. Please log in with this email or register with a different one.";
                return(Redirect("/Account/Login"));
            }

            db.AddUser(u);
            TempData["Success-Message"] = $"Thank you for signing up! You are registered with user: {u.Email}. Please log into proceed.";

            return(Redirect("/Account/Login"));
        }