Пример #1
0
        public async Task <ServiceResult> DeleteAsync(long id)
        {
            var exist = await _tagRepo.Select.AnyAsync(c => c.Id == id);

            if (!exist)
            {
                return(await Task.FromResult(ServiceResult.Failed($"Id:{id} 的文章标签不存在")));
            }
            // 先删除与文章的关系
            await _articleTagRepo.DeleteAsync(a => a.TagId == id);

            // 删除文章标签
            await _tagRepo.DeleteAsync(id);

            return(await Task.FromResult(ServiceResult.Successed("删除文章标签成功")));
        }