예제 #1
0
        public IActionResult AddArticleCategory(ArticleCategory model)
        {
            //获取上级栏目
            if (string.IsNullOrWhiteSpace(model.KindName))
            {
                tip.Message = "文章栏目标题不能为空!";
                return(Json(tip));
            }
            model.Insert();
            Core.Admin.WriteLogActions("添加文章栏目(id:" + model.Id + ");");
            tip.Status    = JsonTip.SUCCESS;
            tip.Message   = "添加文章栏目成功";
            tip.ReturnUrl = "close";

            return(Json(tip));
        }
예제 #2
0
        public IActionResult AddArticleCategory(ArticleCategory model)
        {
            //获取上级栏目
            if (string.IsNullOrWhiteSpace(model.KindName))
            {
                tip.Message = "文章栏目标题不能为空!";
                return(Json(tip));
            }
            if (string.IsNullOrEmpty(model.FilePath))
            {
                tip.Message = "文章栏目路径不能为空!";
                return(Json(tip));
            }

            if (!model.FilePath.StartsWith("/"))
            {
                tip.Message = "栏目路径请以/开头!";
                return(Json(tip));
            }
            if (model.FilePath.EndsWith("/"))
            {
                tip.Message = "栏目路径结尾不用加上/";
                return(Json(tip));
            }
            if (model.FilePath.Count(x => x == '/') > 4)
            {
                tip.Message = "最多只能四级路径!";
                return(Json(tip));
            }

            if (!AdminUtils.CheckFilePathIsOK(model.FilePath, 0, 0))
            {
                tip.Message = "栏目路径不可用,请重新填写!";
                return(Json(tip));
            }

            model.Insert();
            Core.Admin.WriteLogActions("添加文章栏目(id:" + model.Id + ");");
            tip.Status    = JsonTip.SUCCESS;
            tip.Message   = "添加文章栏目成功";
            tip.ReturnUrl = "close";

            return(Json(tip));
        }