public ActionResult Create(ProductSuppliers productsuppliers) { if (ModelState.IsValid) { db.ProductSuppliers.Add(productsuppliers); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.Product = new SelectList(db.Products, "Id", "Name", productsuppliers.Product); ViewBag.Supplier = new SelectList(db.Suppliers, "Id", "Name", productsuppliers.Supplier); return View(productsuppliers); }
public ActionResult Edit(ProductSuppliers productsuppliers) { if (ModelState.IsValid) { db.Entry(productsuppliers).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.Product = new SelectList(db.Products, "Id", "Name", productsuppliers.Product); ViewBag.Supplier = new SelectList(db.Suppliers, "Id", "Name", productsuppliers.Supplier); return View(productsuppliers); }