protected void Page_Load(object sender, EventArgs e) { using (EntityBaglan database = new EntityBaglan()) { Tekrar1.DataSource = database.OgrenciBilgi.ToList(); Tekrar1.DataBind(); } if (Request.QueryString["ID"] != null) { int id = int.Parse(Request.QueryString["ID"]); using (EntityBaglan database = new EntityBaglan()) { var deger = database.OgrenciBilgi.Find(id); database.OgrenciBilgi.Remove(deger); database.SaveChanges(); Response.Redirect("Ogrenciler.aspx"); } } if (Request.QueryString["GID"] != null) { int gid = int.Parse(Request.QueryString["GID"]); using (EntityBaglan database = new EntityBaglan()) { var deger = database.OgrenciBilgi.Find(gid); txtOgrAdi.Text = deger.OgrAdi; txtOgrSoyAdi.Text = deger.OgrSoyadi; txtOgrNo.Text = Convert.ToString(deger.OgrNo); } } }
protected void Page_Load(object sender, EventArgs e) { using (EntityBaglan database = new EntityBaglan()) { Tekrar1.DataSource = database.Kurslar.ToList(); Tekrar1.DataBind(); } if (!IsPostBack) { if (Request.QueryString["ID"] != null) { int id = int.Parse(Request.QueryString["ID"]); using (EntityBaglan database = new EntityBaglan()) { var deger = database.Kurslar.Find(id); database.Kurslar.Remove(deger); database.SaveChanges(); Response.Redirect("Kurslar.aspx"); } } if (Request.QueryString["GID"] != null) { int gid = int.Parse(Request.QueryString["GID"]); using (EntityBaglan database = new EntityBaglan()) { var deger = database.Kurslar.Find(gid); txtkursAdi.Text = deger.kursAdi; txtkurssaati.Text = Convert.ToString(deger.kursSaati); txtkursucreti.Text = Convert.ToString(deger.KursUcret); } } } }