public ActionResult DeleteConfirmed(int id) { poem poem = db.poems.Find(id); db.poems.Remove(poem); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "poemId,Title,Description,Image,PubDate")] poem poem) { if (ModelState.IsValid) { db.Entry(poem).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(poem)); }
public ActionResult Create([Bind(Include = "poemId,Title,Description,Image,PubDate")] poem poem) { if (ModelState.IsValid) { db.poems.Add(poem); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(poem)); }
// GET: /poem/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } poem poem = db.poems.Find(id); if (poem == null) { return(HttpNotFound()); } return(View(poem)); }