diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Contents/GetContentInput.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Contents/GetContentInput.cs new file mode 100644 index 0000000000..8efddd1e35 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Contents/GetContentInput.cs @@ -0,0 +1,8 @@ +namespace Volo.CmsKit.Common.Application.Contracts.Volo.CmsKit.Contents +{ + public class GetContentInput + { + public string EntityType { get; set; } + public string EntityId { get; set; } + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Contents/IContentAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Contents/IContentAppService.cs index 0ac862e787..714fb6e4fb 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Contents/IContentAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Contents/IContentAppService.cs @@ -1,10 +1,10 @@ using System.Threading.Tasks; -using Volo.CmsKit.Contents; +using Volo.CmsKit.Common.Application.Contracts.Volo.CmsKit.Contents; namespace Volo.CmsKit.Contents { public interface IContentAppService { - Task GetAsync(string entityType, string entityId); + Task GetAsync(GetContentInput input); } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Contents/ContentAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Contents/ContentAppService.cs index 77f2fe39ef..14dc318a4d 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Contents/ContentAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Contents/ContentAppService.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Volo.CmsKit.Common.Application.Contracts.Volo.CmsKit.Contents; namespace Volo.CmsKit.Contents { @@ -15,9 +16,12 @@ namespace Volo.CmsKit.Contents _contentRepository = contentRepository; } - public async Task GetAsync(string entityType, string entityId) + public async Task GetAsync(GetContentInput input) { - var entity = await _contentRepository.FindAsync(entityType, entityId); // Tenant??? + var entity = await _contentRepository.FindAsync( + input.EntityType, + input.EntityId, + CurrentTenant.Id); return ObjectMapper.Map(entity); } diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.HttpApi/Volo/CmsKit/Controllers/Contents/ContentController.cs b/modules/cms-kit/src/Volo.CmsKit.Common.HttpApi/Volo/CmsKit/Controllers/Contents/ContentController.cs new file mode 100644 index 0000000000..260668e52d --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Common.HttpApi/Volo/CmsKit/Controllers/Contents/ContentController.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Volo.CmsKit.Common.Application.Contracts.Volo.CmsKit.Contents; +using Volo.CmsKit.Contents; + +namespace Volo.CmsKit.Controllers.Contents +{ + public class ContentController : CmsKitControllerBase, IContentAppService + { + protected readonly IContentAppService _contentAppService; + + public ContentController(IContentAppService contentAppService) + { + _contentAppService = contentAppService; + } + + public virtual Task GetAsync(GetContentInput input) + { + return _contentAppService.GetAsync(input); + } + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Shared/Components/Contents/ContentViewComponent.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Shared/Components/Contents/ContentViewComponent.cs index 012768b0d7..14522303c6 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Shared/Components/Contents/ContentViewComponent.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Shared/Components/Contents/ContentViewComponent.cs @@ -7,6 +7,7 @@ using Microsoft.Extensions.Options; using Volo.Abp.AspNetCore.Mvc; using Volo.Abp.AspNetCore.Mvc.UI; using Volo.Abp.AspNetCore.Mvc.UI.Widgets; +using Volo.CmsKit.Common.Application.Contracts.Volo.CmsKit.Contents; using Volo.CmsKit.Contents; using Volo.CmsKit.Web.Contents; @@ -30,7 +31,12 @@ namespace Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.Contents string entityType, string entityId) { - var content = await contentAppService.GetAsync(entityType, entityId); + var content = await contentAppService.GetAsync(new GetContentInput + { + EntityId = entityId, + EntityType = entityType + }); + var viewModel = new ContentViewModel { EntityId = entityId,