Exemple #1
0
        public JsonResult Delete(int catId)
        {
            CheckPermission();

            using (var result = new ResponseResult <object>())
            {
                var hasArticlesUnderThisCategory = _articleService.Count(m => m.CatId == catId) > 0;
                if (hasArticlesUnderThisCategory)
                {
                    throw new CustomException("该分类下有文章,不可删除!");
                }

                var effectCount = _articleCategoryService.Delete("CategoryId", catId);
                result.Entity = effectCount;
                return(new JsonResultEx(result));
            }
        }
Exemple #2
0
 public object ArticleCount(string title, int categoryId, int tagId)
 {
     return(_Article.Count(title, categoryId, tagId, 0));
 }