public ActionResult Olustur([Bind(Include = "KullaniciId,Ad,Sifre,KullaniciAdi")] Kullanici kullanici) { if (ModelState.IsValid) { db.Kullanicilar.Add(kullanici); db.SaveChanges(); return(Redirect("/Home")); } return(View(kullanici)); }
public ActionResult Sil(int?id) { using (TakimContext ctx = new TakimContext()) { var oyn = ctx.Oyuncular.Find(id); ctx.Oyuncular.Remove(oyn); ctx.SaveChanges(); return(RedirectToAction("Index")); } }
public ActionResult Duzenle(Oyuncu oyn) { if (ModelState.IsValid) { using (TakimContext ctx = new TakimContext()) { ctx.Entry(oyn).State = EntityState.Modified; int sonuc = ctx.SaveChanges(); if (sonuc > 0) { return(RedirectToAction("Index")); } } } return(View(oyn)); }
public ActionResult Ekle(Oyuncu o) { if (ModelState.IsValid) { using (TakimContext ctx = new TakimContext()) { ctx.Oyuncular.Add(o); int sonuc = ctx.SaveChanges(); if (sonuc > 0) { return(RedirectToAction("Index")); } } } return(View()); }