public ActionResult DeleteConfirmed(int id) { Artwork artwork = db.Artworks.Find(id); db.Artworks.Remove(artwork); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,Name,ImgUrl,Price")] Artwork artwork) { if (ModelState.IsValid) { db.Entry(artwork).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(artwork)); }
public ActionResult Create([Bind(Include = "Id,Name,ImgUrl,Price")] Artwork artwork) { if (ModelState.IsValid) { db.Artworks.Add(artwork); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(artwork)); }
// GET: Artworks/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Artwork artwork = db.Artworks.Find(id); if (artwork == null) { return(HttpNotFound()); } return(View(artwork)); }