public ActionResult Create(User user) { if (ModelState.IsValid) { Users.AddUser(user); return RedirectToAction("Index", "Data"); } else return View(user); }
public static void AddUser(User p) { OleDbConnection conn = MyConnection.GetConnection(); OleDbCommand cmd = new OleDbCommand(AddQuery, conn); cmd.Parameters.AddWithValue("@name", p.name); cmd.Parameters.AddWithValue("@pass", p.pass); cmd.Parameters.AddWithValue("@isadmin", 0); cmd.Parameters.AddWithValue("@mail", p.mail); cmd.Parameters.AddWithValue("@phone", p.phone); cmd.ExecuteNonQuery(); }