public void AddPegawai(AddPegawai p) { string cmd = string.Format("INSERT INTO pegawai (nip,nama,agama,ttl,alamat,notelp) values('{0}','{1}','{2}','{3}','{4}','{5}')", p.NIP, p.Name, p.Agama, p.TTL, p.Alamat, p.Telpon); MySqlConnection conn = new MySqlConnection(System.Configuration.ConfigurationManager.AppSettings["ConnectionString"]); conn.Open(); MySqlCommand command = new MySqlCommand(cmd, conn); command.ExecuteReader(); conn.Close(); }
public ActionResult AddPegawai(AddPegawai pegawai) { pegawaiRepo.AddPegawai(pegawai); return RedirectToAction("Index", "Pegawai"); }