public ActionResult UpdateHaber(HABER hbr) { LOKANTAEntities db = new LOKANTAEntities(); db.HABER.Attach(hbr); db.Entry(hbr).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index", "Anasayfa")); }
public ActionResult DeleteHaber(int id) { if (id != null && id > 0) { LOKANTAEntities db = new LOKANTAEntities(); HABER silinecek = db.HABER.Where(x => x.HaberId == id).FirstOrDefault(); db.HABER.Remove(silinecek); db.SaveChanges(); } return(RedirectToAction("Index")); }
public ActionResult KaydetModel(HABER p) { HABER s = new HABER(); s.HaberBaslik = p.HaberBaslik; s.HaberIcerik = p.HaberIcerik; s.HaberOnyazi = p.HaberOnyazi; s.HaberTuru = 1; s.YayinlanmaTarihi = DateTime.Now; LOKANTAEntities db = new LOKANTAEntities(); db.HABER.Add(s); db.SaveChanges(); return(RedirectToAction("Index")); }