Beispiel #1
0
 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);
 }
Beispiel #2
0
        public ActionResult Create(Customer customer)
        {
            if (ModelState.IsValid)
            {
                customer.Creation = DateTime.Now;
                db.Customers.AddObject(customer);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(customer);
        }