Ejemplo n.º 1
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            BlogSitesiEntities2 db = new BlogSitesiEntities2();
            int id          = int.Parse(Request.QueryString["Id"]);
            var guncelkayit = db.Kategori.Find(id);

            guncelkayit.KategoriAdi      = txtKategoriAdi.Text;
            guncelkayit.KategoriAciklama = txtArea.Text;
            db.SaveChanges();
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            BlogSitesiEntities2 db = new BlogSitesiEntities2();
            Makale makaleAdd       = new Makale();

            makaleAdd.KategoriId             = Convert.ToInt32(DrpKategoriler.SelectedValue);
            makaleAdd.MakaleBaslik           = txtmakaleAdi.Text;
            makaleAdd.MakaleIcerik           = txtArea.Text;
            makaleAdd.MakaleEtiketlemeTarihi = DateTime.Parse(txtEtiketTarihi.Text);
            db.Makale.Add(makaleAdd);
            db.SaveChanges();
            Response.Redirect("makaleler.aspx");
        }
Ejemplo n.º 3
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     try
     {
         BlogSitesiEntities2 db       = new BlogSitesiEntities2();
         Kategori            kategori = new Kategori();
         kategori.KategoriAdi      = txtKategoriAdi.Text;
         kategori.KategoriAciklama = txtArea.Text;
         db.Kategori.Add(kategori);
         db.SaveChanges();
         Response.Redirect("kategoriler.aspx");
     }
     catch (Exception)
     {
         throw;
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         BlogSitesiEntities2 db = new BlogSitesiEntities2();
         var makaleler          = db.Makale.ToList();
         Repeater1.DataSource = makaleler;
         Repeater1.DataBind();
     }
     catch (Exception)
     {
         throw;
     }
     if (Request.QueryString["Id"] != null)
     {
         BlogSitesiEntities2 db = new BlogSitesiEntities2();
         int id        = int.Parse(Request.QueryString["Id"]);
         var makaleSil = db.Makale.Find(id);
         db.Makale.Remove(makaleSil);
         db.SaveChanges();
         Response.Redirect("makaleler.aspx");
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            BlogSitesiEntities2 db = new BlogSitesiEntities2();

            try
            {
                var kategoriler = db.Kategori.ToList();
                Repeater1.DataSource = kategoriler;
                Repeater1.DataBind();
            }
            catch (Exception)
            {
                throw;
            }
            if (Request.QueryString["Id"] != null)
            {
                int id       = int.Parse(Request.QueryString["Id"]);
                var silKayit = db.Kategori.Find(id);
                db.Kategori.Remove(silKayit);
                db.SaveChanges();
                Response.Redirect("kategoriler.aspx");
            }
        }