public ActionResult Duzenle(int?id)
        {
            using (TurkeyContext tx = new TurkeyContext())
            {
                var bhr = tx.Bolgeler.Find(id);

                return(View(bhr));
            }
        }
Esempio n. 2
0
        public ActionResult Duzenle(int?id)
        {
            using (TurkeyContext ctx = new TurkeyContext())
            {
                var shr = ctx.Sehirler.Find(id);

                return(View(shr));
            }
        }
Esempio n. 3
0
 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"));
     }
 }
Esempio n. 4
0
        // 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));
            }
        }
Esempio n. 7
0
 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());
     }
 }
Esempio n. 8
0
 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);
 }