Пример #1
0
        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"));
        }
Пример #2
0
        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"));
        }
Пример #3
0
        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"));
        }