Beispiel #1
0
 public async Task <BlogCategory> GetOneCategoryById(Guid categoryId)
 {
     using (IBlogCategory blogcategorySvc = new BlogCategoryService())
     {
         return(await blogcategorySvc.GetOneByIdAsync(categoryId));
     }
 }
Beispiel #2
0
        public async Task RemoveCategory(Guid categoryId)
        {
            using (IBlogCategory blogcategorySvc = new BlogCategoryService())
            {
                BlogCategory blogcategory = await blogcategorySvc.GetOneByIdAsync(categoryId);

                await blogcategorySvc.DeleteAsync(blogcategory);
            }
        }
Beispiel #3
0
        public async Task EditCategory(Guid categoryId, string newCategoryName)
        {
            using (IBlogCategory blogCategorySvc = new BlogCategoryService())
            {
                //获取当前分类的实体,修改分类名字
                var category = await blogCategorySvc.GetOneByIdAsync(categoryId);

                category.CategoryName = newCategoryName;
                await blogCategorySvc.EditAsync(category);
            }
        }