public ActionResult Kaydet(personel personel) { if (!ModelState.IsValid) { var model = new PersonelFromViewModel() { Departmanlar = db.Departman.ToList(), Personel = personel }; return(View("PersonelForm", model)); } if (personel.p_no == 0) { db.personel.Add(personel); } else { if (personel == null) { return(HttpNotFound()); } else { db.Entry(personel).State = System.Data.Entity.EntityState.Modified; } } db.SaveChanges(); return(RedirectToAction("PersonelList")); }
public ActionResult Edit([Bind(Include = "ID,KullaniciAdi,Sifre,Rol")] Kullanicilar kullanicilar) { if (ModelState.IsValid) { db.Entry(kullanicilar).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(kullanicilar)); }