public ActionResult Create(Customer_Company customer_Company) { if (ModelState.IsValid) { db.Customer_Company.Add(customer_Company); db.SaveChanges(); return RedirectToAction("Index","Customers"); } ViewBag.CompanyID = new SelectList(db.Company, "CompanyID", "CompanyName", customer_Company.CompanyID); ViewBag.CustomerID = new SelectList(db.Customer, "CustomerID", "FirstName", customer_Company.CustomerID); return View(customer_Company); }
public ActionResult Edit( Customer_Company customer_Company) { if (ModelState.IsValid) { db.Entry(customer_Company).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.CompanyID = new SelectList(db.Company, "CompanyID", "CompanyName", customer_Company.CompanyID); ViewBag.CustomerID = new SelectList(db.Customer, "CustomerID", "FirstName", customer_Company.CustomerID); return View(customer_Company); }