public async Task EditCategory(Guid categoryId, string newCategoryName) //修改类别 { using (IBlogCategoryService categorySvc = new BlogCategoryService()) { var cate = await categorySvc.GetAllAsync().FirstAsync(m => m.Id == categoryId); cate.CategoryName = newCategoryName; await categorySvc.EditAsync(cate); } }
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); } }