public ActionResult Duzenle(int?id) { using (TurkeyContext tx = new TurkeyContext()) { var bhr = tx.Bolgeler.Find(id); return(View(bhr)); } }
public ActionResult Duzenle(int?id) { using (TurkeyContext ctx = new TurkeyContext()) { var shr = ctx.Sehirler.Find(id); return(View(shr)); } }
public ActionResult Sil(int?id) { using (TurkeyContext ctx = new TurkeyContext()) { var shr = ctx.Sehirler.Find(id); ctx.Sehirler.Remove(shr); ctx.SaveChanges(); return(RedirectToAction("Index")); } }
// GET: Sehir public ActionResult Index() { using (TurkeyContext ctx = new TurkeyContext()) { SehirviewModel svm = new SehirviewModel(); svm.Sehirler = ctx.Sehirler.ToList(); return(View(svm)); } }
public ActionResult Sil(int?id) { using (TurkeyContext tx = new TurkeyContext()) { var bhr = tx.Bolgeler.Find(id); tx.Bolgeler.Remove(bhr); tx.SaveChanges(); return(RedirectToAction("Index")); } }
public ActionResult Index() { using (TurkeyContext tx = new TurkeyContext()) { BolgeviewModel bvm = new BolgeviewModel(); bvm.Bolgeler = tx.Bolgeler.ToList(); return(View(bvm)); } }
public ActionResult Duzenle(Sehir shr) { using (TurkeyContext ctx = new TurkeyContext()) { ctx.Entry(shr).State = EntityState.Modified; int sonuc = ctx.SaveChanges(); if (sonuc > 0) { return(RedirectToAction("Index")); } return(View()); } }
public bool Ekle(Sehir s) { if (ModelState.IsValid)//bu dogrulama düzenlede de olmalı projede { using (TurkeyContext ctx = new TurkeyContext()) { ctx.Sehirler.Add(s); int sonuc = ctx.SaveChanges(); if (sonuc > 0) { return(true); } } } return(false); }
public bool Ekle(Bolge b) { if (ModelState.IsValid) { using (TurkeyContext tx = new TurkeyContext()) { tx.Bolgeler.Add(b); int sonuc = tx.SaveChanges(); if (sonuc > 0) { return(true); } } } return(false); }