Example #1
0
        public ActionResult Create(Car car)
        {
            if (ModelState.IsValid)
            {
                db.Cars.Add(car);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(car);
        }
Example #2
0
 public ActionResult Edit(Car car)
 {
     if (ModelState.IsValid)
     {
         db.Entry(car).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(car);
 }