Esempio n. 1
0
 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));
 }
Esempio n. 2
0
 public ActionResult Kaydet(Personel personel)
 {
     if (personel.Id == 0) //Ekleme işlemi
     {
         db.Personel.Add(personel);
     }
     else //Güncelle
     {
         db.Entry(personel).State = System.Data.Entity.EntityState.Modified;
     }
     db.SaveChanges();
     return(RedirectToAction("Index", "Personel"));
 }
 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"));
 }