Browse Source

CmsKit - Remove SetContentByEntity

pull/7404/head
enisn 6 years ago
parent
commit
15ba1bdfb5
  1. 2
      modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Contents/IContentAdminAppService.cs
  2. 27
      modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Contents/ContentAdminAppService.cs
  3. 8
      modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/Contents/ContentAdminController.cs

2
modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Contents/IContentAdminAppService.cs

@ -15,7 +15,5 @@ namespace Volo.CmsKit.Admin.Contents
ContentUpdateDto>
{
Task<ContentDto> GetByEntityAsync(string entityType, string entityId);
Task SetByEntityAsync(string entityType, string entityId, ContentSetByEntityInput input);
}
}

27
modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Contents/ContentAdminAppService.cs

@ -68,32 +68,5 @@ namespace Volo.CmsKit.Admin.Contents
return ObjectMapper.Map<Content, ContentDto>(content);
}
public async Task SetByEntityAsync(
[NotNull] string entityType,
[NotNull] string entityId,
ContentSetByEntityInput input)
{
Check.NotNullOrWhiteSpace(entityType, nameof(entityType));
Check.NotNullOrWhiteSpace(entityId, nameof(entityId));
var updated = await ContentRepository.FindAsync(entityType, entityId);
if (updated == null)
{
await ContentRepository.InsertAsync(
new Content(
GuidGenerator.Create(),
entityType,
entityId,
input.Value,
CurrentTenant?.Id));
}
else
{
updated.SetValue(input.Value);
await ContentRepository.UpdateAsync(updated);
}
}
}
}

8
modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/Contents/ContentAdminController.cs

@ -67,13 +67,5 @@ namespace Volo.CmsKit.Admin.Contents
{
return ContentAdminAppService.GetByEntityAsync(entityType, entityId);
}
[HttpPost]
[Route("{entityType}/{entityId}")]
[Authorize(CmsKitAdminPermissions.Contents.Update)]
public Task SetByEntityAsync(string entityType, string entityId, ContentSetByEntityInput input)
{
return ContentAdminAppService.SetByEntityAsync(entityType, entityId, input);
}
}
}

Loading…
Cancel
Save