|
|
|
|
@ -2,76 +2,69 @@
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
using Volo.Abp;
|
|
|
|
|
using Volo.CmsKit.Pages;
|
|
|
|
|
using Volo.CmsKit.Admin.Pages;
|
|
|
|
|
|
|
|
|
|
namespace Volo.CmsKit.Controllers.Pages
|
|
|
|
|
namespace Volo.CmsKit.Admin.Page
|
|
|
|
|
{
|
|
|
|
|
[RemoteService(Name = CmsKitCommonRemoteServiceConsts.RemoteServiceName)]
|
|
|
|
|
[Area("cms-kit")]
|
|
|
|
|
[Route("api/cms-kit/pages")]
|
|
|
|
|
public class PageController : CmsKitControllerBase, IPageAppService
|
|
|
|
|
[Route("api/cms-kit-admin/pages")]
|
|
|
|
|
public class PageAdminController : CmsKitAdminController, IPageAdminAppService
|
|
|
|
|
{
|
|
|
|
|
protected readonly IPageAppService PageAppService;
|
|
|
|
|
protected readonly IPageAdminAppService PageAdminAppService;
|
|
|
|
|
|
|
|
|
|
public PageController(IPageAppService pageAppService)
|
|
|
|
|
public PageAdminController(IPageAdminAppService pageAdminAppService)
|
|
|
|
|
{
|
|
|
|
|
PageAppService = pageAppService;
|
|
|
|
|
PageAdminAppService = pageAdminAppService;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpGet]
|
|
|
|
|
[Route("{id}")]
|
|
|
|
|
public virtual Task<PageDto> GetAsync(Guid id)
|
|
|
|
|
{
|
|
|
|
|
return PageAppService.GetAsync(id);
|
|
|
|
|
return PageAdminAppService.GetAsync(id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpGet]
|
|
|
|
|
[Route("url/{url}")]
|
|
|
|
|
public Task<PageDto> GetByUrlAsync(string url)
|
|
|
|
|
{
|
|
|
|
|
return PageAppService.GetByUrlAsync(url);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
[Route("create")]
|
|
|
|
|
public virtual Task<PageDto> CreatePageAsync(CreatePageInputDto input)
|
|
|
|
|
{
|
|
|
|
|
return PageAppService.CreatePageAsync(input);
|
|
|
|
|
return PageAdminAppService.CreatePageAsync(input);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
[Route("create-with-content")]
|
|
|
|
|
public virtual Task<PageDto> CreatePageWithContentAsync(CreatePageWithContentInputDto input)
|
|
|
|
|
{
|
|
|
|
|
return PageAppService.CreatePageWithContentAsync(input);
|
|
|
|
|
return PageAdminAppService.CreatePageWithContentAsync(input);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpPut]
|
|
|
|
|
[Route("{id}")]
|
|
|
|
|
public virtual Task<PageDto> UpdatePageAsync(Guid id, UpdatePageInputDto input)
|
|
|
|
|
{
|
|
|
|
|
return PageAppService.UpdatePageAsync(id, input);
|
|
|
|
|
return PageAdminAppService.UpdatePageAsync(id, input);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
[Route("does-url-exist")]
|
|
|
|
|
public virtual Task<bool> DoesUrlExistAsync(CheckUrlInputDto input)
|
|
|
|
|
{
|
|
|
|
|
return PageAppService.DoesUrlExistAsync(input);
|
|
|
|
|
return PageAdminAppService.DoesUrlExistAsync(input);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpPut]
|
|
|
|
|
[Route("update-content/{id}")]
|
|
|
|
|
public virtual Task UpdatePageContentAsync(Guid id, UpdatePageContentInputDto input)
|
|
|
|
|
{
|
|
|
|
|
return PageAppService.UpdatePageContentAsync(id, input);
|
|
|
|
|
return PageAdminAppService.UpdatePageContentAsync(id, input);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpDelete]
|
|
|
|
|
[Route("{id}")]
|
|
|
|
|
public virtual Task DeleteAsync(Guid id)
|
|
|
|
|
{
|
|
|
|
|
return PageAppService.DeleteAsync(id);
|
|
|
|
|
return PageAdminAppService.DeleteAsync(id);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|