示例#1
0
 public ActionResult Edit(Car car)
 {
     if (ModelState.IsValid)
     {
         db.Entry(car).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(car);
 }
示例#2
0
        public ActionResult Create(Car car)
        {
            if (ModelState.IsValid)
            {
                car.Id = Guid.NewGuid();
                db.Cars.Add(car);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(car);
        }