public ActionResult creatUser(FairOrderingSystem.Models.Company comp) { if (ModelState.IsValid) { string company = comp.companyName; string Cell = comp.cell; string Phone = comp.phone; string Password = comp.password; string Email = comp.email; string connectionString = "Server=localhost;" + "Database=fair;" + "User ID=shane;" + "Password=Gaming12;" + "Pooling=false"; string sqlCommand = "INSERT INTO COMPANIES VALUES ('" + company + "','" + Cell + "','" + Phone + "','" + Password + "',NULL,'" + Email + "');"; MySqlConnection conn = new MySqlConnection(connectionString); conn.Open(); MySqlCommand comm = conn.CreateCommand(); comm.CommandText = sqlCommand; comm.BeginExecuteNonQuery(); return(View()); } return(View("NewUser")); }
public ActionResult creatUser() { FairOrderingSystem.Models.Company comp = new FairOrderingSystem.Models.Company(); return(View(comp)); }