예제 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            editorial editorial = db.editorials.Find(id);

            db.editorials.Remove(editorial);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #2
0
 public ActionResult Edit([Bind(Include = "EditorialId,Title,Description,Image,PubDate")] editorial editorial)
 {
     if (ModelState.IsValid)
     {
         db.Entry(editorial).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(editorial));
 }
예제 #3
0
        public ActionResult Create([Bind(Include = "EditorialId,Title,Description,Image,PubDate")] editorial editorial)
        {
            if (ModelState.IsValid)
            {
                db.editorials.Add(editorial);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(editorial));
        }
예제 #4
0
        // GET: /editorial/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            editorial editorial = db.editorials.Find(id);

            if (editorial == null)
            {
                return(HttpNotFound());
            }
            return(View(editorial));
        }