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

            var service = new CatService();

            if (service.CreateCat(model))
            {
                TempData["SaveResult"] = "Your cat was added.";
                return(RedirectToAction("Index"));
            }
            ;
            ModelState.AddModelError("", "Cat could not be added.");
            return(View(model));
        }