Example #1
0
 public ActionResult Edit([Bind(Include = "Id,Ad,Sifre,Role")] User user)
 {
     if (ModelState.IsValid)
     {
         db.Entry(user).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(user));
 }
 public ActionResult Kaydet(Urunler urunler)
 {
     if (!ModelState.IsValid)
     {
         var model = new KategoriFormViewModels()
         {
             Kategoriler = db.Kategori.ToList(),
             urunler     = urunler
         };
         return(View("UrunlerForm"));
     }
     if (urunler.urun_id == 0)
     {
         db.Urunler.Add(urunler);
     }
     else
     {
         db.Entry(urunler).State = System.Data.Entity.EntityState.Modified;
     }
     db.SaveChanges();
     return(RedirectToAction("Index"));
 }