public ActionResult CreateAcousticGuitar(AcousticGuitar acousticGuitar)
        {
            if (ModelState.IsValid)
            {
                _db.Guitars.Add(acousticGuitar);
                _db.SaveChanges();
                return RedirectToAction("Index");
            }

            FillAcousticGuitarViewBag();

            return View(acousticGuitar);
        }
        public ActionResult Create(AcousticGuitar acousticguitar)
        {
            if (ModelState.IsValid)
            {
                acousticguitar.FingerboardWood = db.Woods.Where(w => w.WoodId == acousticguitar.FingerboardWoodId).First();
                acousticguitar.BodyWood = db.Woods.Where(w => w.WoodId == acousticguitar.BodyWoodId).First();
                acousticguitar.FretboardWood = db.Woods.Where(w => w.WoodId == acousticguitar.FretboardWoodId).First();
                db.Guitars.Add(acousticguitar);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            FillAcousticGuitarViewBag(acousticguitar);
            return View(acousticguitar);
        }
        private void FillAcousticGuitarViewBag(AcousticGuitar g)
        {
            FillGuitarViewBag(g);

            ViewBag.BodyTypeId = new SelectList(db.BodyTypes, "Id", "Name", g.BodyTypeId);
        }
 public ActionResult Edit(AcousticGuitar acousticguitar)
 {
     if (ModelState.IsValid)
     {
         acousticguitar.FingerboardWood = db.Woods.Where(w => w.WoodId == acousticguitar.FingerboardWoodId).First();
         acousticguitar.BodyWood = db.Woods.Where(w => w.WoodId == acousticguitar.BodyWoodId).First();
         acousticguitar.FretboardWood = db.Woods.Where(w => w.WoodId == acousticguitar.FretboardWoodId).First();
         db.Entry(acousticguitar).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     FillAcousticGuitarViewBag(acousticguitar);
     return View(acousticguitar);
 }