コード例 #1
0
        public ActionResult Create(CreateCarInputModel model)
        {
            try
            {
                if (!this.ModelState.IsValid)
                {
                    return(this.View(model));
                }

                var car = this.carService.Create(model).GetAwaiter().GetResult();

                return(this.RedirectToAction("Details", "Cars", new { id = car.Id }));
            }
            catch (Exception e)
            {
                return(this.View("_Error", e.Message));
            }
        }