public ActionResult AddCustomer(Customer newCustomer) { if (ModelState.IsValid) { db.Customers.Add(newCustomer); db.SaveChanges(); return RedirectToAction("Index","Home"); } return View(newCustomer); }
public ActionResult Edit(Customer customer) { if (ModelState.IsValid) { db.Entry(customer).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("CustomerDetails", "Customer", new { customerId = customer.customerId }); } return View( customer); }