public void bindKategoriler()
        {
            BlogSitesiEntities2 db = new BlogSitesiEntities2();
            var Kategori           = db.Kategori.ToList();

            BindDropDownList(DrpKategoriler, Kategori, "KategoriAdi");
        }
Example #2
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();
        }
Example #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            BlogSitesiEntities2 db = new BlogSitesiEntities2();

            if (!Page.IsPostBack)
            {
                int id   = int.Parse(Request.QueryString["Id"]);
                var veri = db.Kategori.Find(id);
                txtKategoriAdi.Text = veri.KategoriAdi;
                txtArea.Text        = veri.KategoriAciklama;
            }
        }
        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");
        }
 protected void DrpKategoriler_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         BlogSitesiEntities2 db = new BlogSitesiEntities2();
         int kategoriId         = Convert.ToInt32(DrpKategoriler.SelectedValue);
         var kategories         = db.Kategori.Where(x => x.KategoriId == kategoriId).ToList();
         BindDropDownList(DrpKategoriler, kategories, "KategoriAdi");
     }
     catch (Exception)
     {
         throw;
     }
 }
Example #6
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;
     }
 }
Example #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            BlogSitesiEntities2 db = new BlogSitesiEntities2();

            if (!Page.IsPostBack)
            {
                int id   = int.Parse(Request.QueryString["Id"]);
                var veri = from m in db.Makale
                           join k in db.Kategori
                           on m.KategoriId equals k.KategoriId
                           select new
                {
                    k.KategoriAdi
                };
                DrpKategoriler.SelectedValue = veri.ToString();
            }
        }
 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");
            }
        }