コード例 #1
0
        public ActionResult Duzenle(int?id)
        {
            using (TurkeyContext tx = new TurkeyContext())
            {
                var bhr = tx.Bolgeler.Find(id);

                return(View(bhr));
            }
        }
コード例 #2
0
        public ActionResult Duzenle(int?id)
        {
            using (TurkeyContext ctx = new TurkeyContext())
            {
                var shr = ctx.Sehirler.Find(id);

                return(View(shr));
            }
        }
コード例 #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"));
     }
 }
コード例 #4
0
        // GET: Sehir
        public ActionResult Index()
        {
            using (TurkeyContext ctx = new TurkeyContext())
            {
                SehirviewModel svm = new SehirviewModel();
                svm.Sehirler = ctx.Sehirler.ToList();

                return(View(svm));
            }
        }
コード例 #5
0
 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"));
     }
 }
コード例 #6
0
        public ActionResult Index()
        {
            using (TurkeyContext tx = new TurkeyContext())
            {
                BolgeviewModel bvm = new BolgeviewModel();
                bvm.Bolgeler = tx.Bolgeler.ToList();

                return(View(bvm));
            }
        }
コード例 #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());
     }
 }
コード例 #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);
 }
コード例 #9
0
 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);
 }