public ActionResult DeleteConfirmed(int id)
        {
            GuitarPart guitarPart = db.GuitarParts.Find(id);

            db.GuitarParts.Remove(guitarPart);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "GuitarPartId,Name,ImageUrl,PartTypeId")] GuitarPart guitarPart)
 {
     if (ModelState.IsValid)
     {
         db.Entry(guitarPart).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.PartTypeId = new SelectList(db.PartTypes, "PartTypeId", "Name", guitarPart.PartTypeId);
     return(View(guitarPart));
 }
        public ActionResult Create([Bind(Include = "GuitarPartId,Name,ImageUrl,PartTypeId")] GuitarPart guitarPart)
        {
            if (ModelState.IsValid)
            {
                db.GuitarParts.Add(guitarPart);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.PartTypeId = new SelectList(db.PartTypes, "PartTypeId", "Name", guitarPart.PartTypeId);
            return(View(guitarPart));
        }
        // GET: GuitarParts/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            GuitarPart guitarPart = db.GuitarParts.Include(d => d.PartType).FirstOrDefault(d => d.GuitarPartId == id);

            if (guitarPart == null)
            {
                return(HttpNotFound());
            }
            return(View(guitarPart));
        }
        // GET: GuitarParts/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            GuitarPart guitarPart = db.GuitarParts.Find(id);

            if (guitarPart == null)
            {
                return(HttpNotFound());
            }
            ViewBag.PartTypeId = new SelectList(db.PartTypes, "PartTypeId", "Name", guitarPart.PartTypeId);
            return(View(guitarPart));
        }