Exemple #1
0
        public async Task <ServiceResult> AddAsync(AddTagDto add)
        {
            var exist = await _tagRepo.Select.AnyAsync(c => c.Name == add.Name);

            if (exist)
            {
                return(await Task.FromResult(ServiceResult.Failed($"Name:{add.Name} 的文章标签已存在")));
            }
            var entity = Mapper.Map <TagEntity>(add);
            await _tagRepo.InsertAsync(entity);

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