コード例 #1
0
        public ActionResult Create([Bind(Include = "MakerName, MakerDescription")] VehicleMake maker)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    Service.AddMaker(maker);
                    return(RedirectToAction("Index"));
                }
            }
            catch (DataException /* dex */)
            {
                //Log the error (uncomment dex variable name and add a line here to write a log.
                ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists see your system administrator.");
            }


            return(View(maker));
        }