public ActionResult listele() { if (Request.QueryString["sil"] != null) { int id = Convert.ToInt32(Request.QueryString["sil"]); try { DUYURULAR hbr = data.DUYURULARs.First(f => f.ID == id); data.DUYURULARs.DeleteOnSubmit(hbr); data.SubmitChanges(); mesaj[0] = "alert-info"; mesaj[1] = "Duyuru başarıyla silindi.."; ViewBag.mesaj = mesaj; } catch { mesaj[0] = "alert-error"; mesaj[1] = "Silme işlemi sırasında gata oluştu !"; ViewBag.mesaj = mesaj; } } ViewBag.Duyurular = data.DUYURULARs; return(View()); }
public ActionResult ekle(string baslik, string editor1) { try { DUYURULAR yeni_duyuru = new DUYURULAR(); yeni_duyuru.BASLIK = baslik; yeni_duyuru.DUYURU = editor1; yeni_duyuru.TARIH = DateTime.Now; data.DUYURULARs.InsertOnSubmit(yeni_duyuru); data.SubmitChanges(); mesaj[0] = "alert-info"; mesaj[1] = "Duyuru başarıyla eklendi.."; ViewBag.mesaj = mesaj; } catch { mesaj[0] = "alert-error"; mesaj[1] = "Duyuru Eklenirken hata oluştu !"; ViewBag.mesaj = mesaj; } return(View()); }
public ActionResult detay(int id, string icerik) { try { DUYURULAR duyuru = data.DUYURULARs.First(f => f.ID == id); duyuru.DUYURU = icerik; data.SubmitChanges(); } catch { } ViewBag.duyuru = data.DUYURULARs.First(f => f.ID == id); return(View()); }