Exemple #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            Artwork artwork = db.Artworks.Find(id);

            db.Artworks.Remove(artwork);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemple #2
0
 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));
 }
Exemple #3
0
        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));
        }
Exemple #4
0
        // 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));
        }