Browse Source

Update TagManager.cs

pull/6756/head
Ahmet 6 years ago
parent
commit
3f76c8d2d2
  1. 8
      modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/TagManager.cs

8
modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/TagManager.cs

@ -59,14 +59,14 @@ namespace Volo.CmsKit.Tags
CancellationToken cancellationToken = default)
{
var entity = await _tagRepository.GetAsync(id, cancellationToken: cancellationToken);
entity.SetName(name);
if (await _tagRepository.AnyAsync(entity.EntityType, name, entity.TenantId, cancellationToken))
if (name != entity.Name && await _tagRepository.AnyAsync(entity.EntityType, name, entity.TenantId, cancellationToken))
{
throw new BusinessException(message: "Tag already exist!"); // Already Exist
}
entity.SetName(name);
return await _tagRepository.UpdateAsync(entity);
}
}

Loading…
Cancel
Save