コード例 #1
0
        public ActionResult Register(string username, string password, string Email)
        {
            RegisterManager r = new RegisterManager();

            if (r.CheckUsername(username) == false && r.CheckPassword(username, password) == true)
            {
                using SqlConnection conn = new SqlConnection(ConfigClass.connectionString);
                using SqlCommand query   = new SqlCommand($"insert into [dbo].[user] (id, username, password, email) values ('{r.GetId()}', '{username}', '{password}', '{Email}')", conn);
                conn.Open();

                query.ExecuteNonQuery();
                conn.Close();
            }
            return(RedirectToAction("Index", "Home"));
        }