コード例 #1
0
 public ActionResult Duzenle(int?id)
 {
     using (TakimContext ctx = new TakimContext())
     {
         var oyn = ctx.Oyuncular.Find(id);
         return(View(oyn));
     }
 }
コード例 #2
0
 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"));
     }
 }
コード例 #3
0
        // GET: Oyuncu


        public ActionResult Index()
        {
            using (TakimContext ctx = new TakimContext())
            {
                if (Session["Kullanici"] == null)
                {
                    return(Redirect("/Home/Main"));
                }

                var oyuncular = ctx.Oyuncular.ToList();
                return(View(oyuncular));
            }
        }
コード例 #4
0
        public ActionResult Index(FormCollection fc)
        {
            using (TakimContext ctx = new TakimContext())
            {
                string KullaniciAdi = fc["KullaniciAdi"];
                string pass         = ctx.Kullanicilar.Where(x => x.KullaniciAdi == KullaniciAdi).SingleOrDefault().Sifre;

                if (fc["Sifre"] == pass)
                {
                    Session["Kullanici"] = KullaniciAdi;
                    return(RedirectToAction("Main"));
                }
            }
            return(View());
        }
コード例 #5
0
 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));
 }
コード例 #6
0
        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());
        }