public ActionResult Create(ProductSpec productspec) { if (ModelState.IsValid) { db.ProductSpecs.Add(productspec); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.ProductID = new SelectList(db.Product, "ProductID", "ProductName", productspec.ProductID); ViewBag.SpecificationID = new SelectList(db.Specification, "SpecificationID", "SpecName", productspec.SpecificationID); return View(productspec); }
public ActionResult Edit(ProductSpec productspec) { if (ModelState.IsValid) { db.Entry(productspec).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.ProductID = new SelectList(db.Product, "ProductID", "ProductName", productspec.ProductID); ViewBag.SpecificationID = new SelectList(db.Specification, "SpecificationID", "SpecName", productspec.SpecificationID); return View(productspec); }