示例#1
0
        public ActionResult Edit(Int32 id)
        {
            anm_News anm_news = db.anm_News.Single(a => a.idnews == id);

            ViewBag.idcategory = new SelectList(db.anm_Categories, "idcategory", "category", anm_news.idcategory);
            return(View(anm_news));
        }
示例#2
0
        public ActionResult DeleteConfirmed(int id)
        {
            anm_News anm_news = db.anm_News.Single(a => a.idnews == id);

            db.anm_News.DeleteObject(anm_news);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#3
0
 public ActionResult Edit(anm_News anm_news)
 {
     if (ModelState.IsValid)
     {
         db.anm_News.Attach(anm_news);
         db.ObjectStateManager.ChangeObjectState(anm_news, EntityState.Modified);
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.idcategory = new SelectList(db.anm_Categories, "idcategory", "category", anm_news.idcategory);
     return(View(anm_news));
 }
示例#4
0
        public ActionResult Create(anm_News anm_news)
        {
            if (ModelState.IsValid)
            {
                db.anm_News.AddObject(anm_news);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.idcategory = new SelectList(db.anm_Categories, "idcategory", "category", anm_news.idcategory);
            return(View(anm_news));
        }
示例#5
0
        //
        // GET: /News/Delete/5

        public ActionResult Delete(int id)
        {
            anm_News anm_news = db.anm_News.Single(a => a.idnews == id);

            return(View(anm_news));
        }
示例#6
0
        //
        // GET: /News/Details/5

        public ViewResult Details(int id)
        {
            anm_News anm_news = db.anm_News.Single(a => a.idnews == id);

            return(View(anm_news));
        }