public ActionResult DepartmanEkleDb(departman gelen) { database.departman.Add(gelen); database.SaveChanges(); return(RedirectToAction("DepartmanListele")); }
public ActionResult DepartmanGuncelleDb(departman gelen) { departman guncellenecekDepartman = database.departman.FirstOrDefault(d => d.id == gelen.id); guncellenecekDepartman.departmanAdi = gelen.departmanAdi; database.SaveChanges(); return(RedirectToAction("DepartmanListele")); }
public ActionResult DepartmanSil(int silinecekid) { departman silinecekDepartman = database.departman.FirstOrDefault(d => d.id == silinecekid); bool departmanVarmi = database.calisanlar.Any(c => c.departmanId == silinecekDepartman.id); if (departmanVarmi == false) { database.departman.Remove(silinecekDepartman); database.SaveChanges(); } else { return(RedirectToAction("DepartmanListele", new { mesaj = "Bu Departmanı Silemezsiniz" })); } return(RedirectToAction("DepartmanListele")); }
internal void departmanKaydet(departman dep) { (new MySqlCommand("INSERT INTO departman (departmanAdi, departmanTel) VALUES('" + dep.DepartmanAdı + "', '" + dep.DepartmanTel + "')", (new dbBaglan()).baglantiGetir())).ExecuteNonQuery(); }
internal void departmanGuncelle(departman dep) { (new MySqlCommand("UPDATE departman set departmanAdi='" + dep.DepartmanAdı + "', departmanTel='" + dep.DepartmanTel + "' where (departmanID='" + dep.Id + "')", (new dbBaglan()).baglantiGetir())).ExecuteNonQuery(); }
public ActionResult DepartmanGuncelle(int guncellenecekid) { departman guncellenecekDepartman = database.departman.FirstOrDefault(d => d.id == guncellenecekid); return(View(guncellenecekDepartman)); }
void guncelle(departman gDep) { label1.Text = gDep.Id.ToString(); txbDepartmanAdi.Text = gDep.DepartmanAdı; txbDepartmanTel.Text = gDep.DepartmanTel; }