Example #1
0
        public ActionResult AddProductCate()
        {
            if (!AppData.IsManagerLogin)
            {
                return(Json(new { success = false, msg = "您未登录后台或会话已过期" }));
            }
            if (PrivilegeBLL.HasNotPrivilege(AppData.SessionUserID, 301))
            {
                return(Json(new { success = false, msg = "您没有执行该操作的权限" }));
            }

            Validation     validation     = new Validation();
            ProductCateObj productCateObj = new ProductCateObj();

            productCateObj.CategoryName = validation.Get("categoryName", false, "新闻分类名称不可为空!");
            productCateObj.ParentID     = validation.GetInt("categoryID");
            productCateObj.Sort         = validation.GetInt("sort");
            if (validation.HasError)
            {
                return(Json(new { success = false, msg = "ValidationFailed", errors = validation.GetErrors() }));
            }

            ProductBLL productBLL = new ProductBLL();

            productBLL.AddProductCate(productCateObj);
            return(Json(new { success = true }));
        }