コード例 #1
0
        public ActionResult CreateCar(Car newCar)
        {
            if(ModelState.IsValid)
            {
                _carService.Add(newCar);
                return RedirectToAction("Cars");
            }

            return View(newCar);
        }
コード例 #2
0
        public ActionResult EditCar(Car editedCar)
        {
            if(ModelState.IsValid)
            {
                _carService.Update(editedCar);
                return RedirectToAction("Cars");
            }

            return View(editedCar);
        }