protected void Button1_Click(object sender, EventArgs e) { try { if (txt_videoyol.Text == "") { Video v = et1.Video .First(i => i.videoID == videoID); v.videoAciklama = txt_videoAciklama.Text; et1.SaveChanges(); Response.Redirect("video_galeri.aspx"); } else { if (txt_videoyol.Text.Length == 11) { Video v = et1.Video .First(i => i.videoID == videoID); v.videoAciklama = txt_videoAciklama.Text; v.videoYol = txt_videoyol.Text; et1.SaveChanges(); Response.Redirect("video_galeri.aspx"); } else { Label2.Text = "UYARI: youtube linki son 11 hanesi"; } } } catch (Exception) { throw; } }
protected void Button1_Click(object sender, EventArgs e) { try { if (FileUpload1.HasFile) { FileUpload1.SaveAs(Server.MapPath("~/webimages/" + FileUpload1.FileName)); Fotograf f = et1.Fotograf .First(i => i.fotografID == fotografID); f.fotografAciklama = txt_fotoaciklama.Text; f.fotografYol = ("~/webimages/" + FileUpload1.FileName); et1.SaveChanges(); Response.Redirect("foto_galeri.aspx"); } else { Fotograf f = et1.Fotograf .First(i => i.fotografID == fotografID); f.fotografAciklama = txt_fotoaciklama.Text; et1.SaveChanges(); Response.Redirect("foto_galeri.aspx"); } } catch (Exception) { throw; } }
protected void Button1_Click(object sender, EventArgs e) { string kullaniciadi = Convert.ToString(Session["yoneticiKullaniciAdi"]); try { if (txt_sifre.Text == txt_sifreonay.Text) { Yonetici y = et1.Yonetici .First(i => i.yoneticiKullaniciAd == kullaniciadi); y.yoneticiSifre = txt_sifre.Text; y.yoneticiEmail = txt_email.Text; et1.SaveChanges(); Response.Redirect("yoneticiler.aspx"); } else { Label2.Text = "sifreler uyusmadi"; } } catch (Exception) { throw; } }
protected void Button1_Click(object sender, EventArgs e) { Haber yeni_haber = new Haber(); yeni_haber.haberBaslik = txt_haberbaslik.Text; yeni_haber.haberIcerik = txt_habericerik.Text; yeni_haber.haberTag = txt_habertag.Text; et1.Haber.AddObject(yeni_haber); et1.SaveChanges(); Response.Redirect("haberler.aspx"); }
protected void Button1_Click(object sender, EventArgs e) { if (txt_videoyol.Text.Length == 11) { Video yeni_video = new Video(); yeni_video.videoAciklama = txt_video_aciklama.Text; yeni_video.videoYol = txt_videoyol.Text; et1.Video.AddObject(yeni_video); et1.SaveChanges(); Response.Redirect("video_galeri.aspx"); } else { Label2.Text = "UYARI: lütfen youtube videosunun son 11 hanesini giriniz"; } }
protected void Button1_Click(object sender, EventArgs e) { if (FileUpload1.HasFile) { FileUpload1.SaveAs(Server.MapPath("~/webimages/" + FileUpload1.FileName)); Fotograf yeni_foto = new Fotograf(); yeni_foto.fotografAciklama = txt_foto_aciklama.Text; yeni_foto.fotografYol = ("~/webimages/" + FileUpload1.FileName); //FileUpload1.FileName; et1.Fotograf.AddObject(yeni_foto); et1.SaveChanges(); Response.Redirect("foto_galeri.aspx"); } else { Label2.Text = "Resim Ekleyiniz!"; } }
protected void Button1_Click(object sender, EventArgs e) { try { Haber h = et1.Haber .First(i => i.haberID == haberID); h.haberBaslik = txt_haberbaslik.Text; h.haberIcerik = txt_habericerik.Text; h.haberTarih = DateTime.Now; h.haberTag = txt_habertag.Text; et1.SaveChanges(); Response.Redirect("haberler.aspx"); } catch (Exception) { throw; } }
protected void Page_Load(object sender, EventArgs e) { islem = Request.QueryString["islem"]; haberID = Convert.ToInt32(Request.QueryString["haberID"]); if (islem == "sil") { var silinecek_haber = et1.Haber.Where(w => w.haberID == haberID).FirstOrDefault(); //Model örneği üzerinden Makale tablomuza erişip Remove() methotunu kullanıyoruz. if (silinecek_haber != null) { et1.Haber.Attach(silinecek_haber); et1.Haber.DeleteObject(silinecek_haber); et1.SaveChanges(); // ile değişiklikleri kaydediyoruz. ve işlemimiz sona eriyor. } } if (Page.IsPostBack == false) { DataList1.DataSource = et1.Haber; DataList1.DataBind(); var sorgu = from c in et1.Haber select new { c.haberID, c.haberBaslik, c.haberIcerik, c.haberOkunmaSayisi, }; DataList1.DataSource = sorgu; CP1.DataSource = sorgu.ToArray(); CP1.BindToControl = DataList1; DataList1.DataSource = CP1.DataSourcePaged; DataList1.DataBind(); } }