public ActionResult Edit(Customer customer) { if (ModelState.IsValid) { db.Customers.Attach(customer); db.ObjectStateManager.ChangeObjectState(customer, EntityState.Modified); db.SaveChanges(); return RedirectToAction("Index"); } return View(customer); }
public ActionResult Create(Customer customer) { if (ModelState.IsValid) { customer.Creation = DateTime.Now; db.Customers.AddObject(customer); db.SaveChanges(); return RedirectToAction("Index"); } return View(customer); }