public ActionResult Create(Customer customer) { if (ModelState.IsValid) { db.Customers.Add(customer); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.BusinessID = new SelectList(db.Businesses, "BusinessID", "BusinessName", customer.BusinessID); return View(customer); }
public ActionResult Edit(Customer customer) { if (ModelState.IsValid) { db.Entry(customer).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.BusinessID = new SelectList(db.Businesses, "BusinessID", "BusinessName", customer.BusinessID); return View(customer); }