Exemplo n.º 1
0
 public ActionResult AddCustomer(Customer newCustomer)
 {
     if (ModelState.IsValid)
     {
         db.Customers.Add(newCustomer);
         db.SaveChanges();
         return RedirectToAction("Index","Home");
     }
     return View(newCustomer);
 }
Exemplo n.º 2
0
 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);
 }