コード例 #1
0
        public ActionResult CreateCategory(Category category)
        {
            var status = administratorSvc.CreateCategory(category);

            if (status == "the name must be unique")
            {
                ModelState.AddModelError("", status);
            }



            if (!ModelState.IsValid)
            {
                return(View(category));
            }

            return(RedirectToAction(nameof(GetAllCategories)));
        }