예제 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            BobbleHead bobbleHead = db.BobbleHeads.Find(id);

            db.BobbleHeads.Remove(bobbleHead);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #2
0
 public ActionResult Edit([Bind(Include = "ID,superHeroName")] BobbleHead bobbleHead)
 {
     if (ModelState.IsValid)
     {
         db.Entry(bobbleHead).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(bobbleHead));
 }
예제 #3
0
        public ActionResult Create([Bind(Include = "ID,superHeroName")] BobbleHead bobbleHead)
        {
            if (ModelState.IsValid)
            {
                db.BobbleHeads.Add(bobbleHead);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

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

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