private void PopulateViewBagWithVendorIDandProductIDSelectLists(VendorProductCreateViewModel vendorProductCreateViewModel) { VendorProduct vendorProduct = new VendorProduct { VendorID = vendorProductCreateViewModel.VendorID, ProductID = vendorProductCreateViewModel.ProductID }; PopulateViewBagWithVendorIDandProductIDSelectLists(vendorProduct); }
public ActionResult Create(VendorProductCreateViewModel vendorProductCreateViewModel) { if (ModelState.IsValid) { VendorProduct vp = new VendorProduct { VendorID = vendorProductCreateViewModel.VendorID, ProductID = vendorProductCreateViewModel.ProductID, UnitPrice = vendorProductCreateViewModel.UnitPrice }; db.VendorProducts.Add(vp); db.SaveChanges(); return(RedirectToAction("Index")); } PopulateViewBagWithVendorIDandProductIDSelectLists(vendorProductCreateViewModel); return(View(vendorProductCreateViewModel)); }