public ActionResult Edit([Bind(Include = "Id,Ad,Sifre,Role")] Kullanici kullanici) { if (ModelState.IsValid) { db.Entry(kullanici).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(kullanici)); }
public ActionResult Kaydet(Personel personel) { if (!ModelState.IsValid) { var model = new PersonelFormViewModel() { Departmanlar = db.Departman.ToList(), Personel = personel }; return(View("PersonelForm", model)); } if (personel.Id == 0) { db.Personel.Add(personel); } else { db.Entry(personel).State = System.Data.Entity.EntityState.Modified; } db.SaveChanges(); return(RedirectToAction("Index")); }