コード例 #1
0
        public ActionResult CreateMainCode(MainCategory model)
        {
            if (ModelState.IsValid)
            {
                model.IsMenu = false;
                try
                {
                    if (_categoryService.GetCategory(model.Code) == null)
                    {
                        _categoryService.CreateCategory(model);
                        _categoryService.SaveCategory();
                        return RedirectToAction("Index");
                    }
                    else
                    {
                        ModelState.AddModelError("Code", ErrorMessages.CATEGORYCODE_EXIST);
                    }
                }
                catch (Exception e)
                {
                    ModelState.AddModelError("", e);
                }

            }
            return View(model);
        }
コード例 #2
0
 public IEnumerable<SubCategory> GetSubCategories(MainCategory mainCategory, ApplicationUser user)
 {
     throw new NotImplementedException();
 }