mirror of https://github.com/abpframework/abp.git
11 changed files with 126 additions and 167 deletions
@ -1,10 +0,0 @@ |
|||
using System.ComponentModel.DataAnnotations; |
|||
|
|||
namespace Volo.CmsKit.Admin.Pages |
|||
{ |
|||
public class CheckUrlInputDto |
|||
{ |
|||
[Required] |
|||
public string Url { get; set; } |
|||
} |
|||
} |
|||
@ -1,18 +0,0 @@ |
|||
using System.ComponentModel.DataAnnotations; |
|||
|
|||
namespace Volo.CmsKit.Admin.Pages |
|||
{ |
|||
public class CreatePageWithContentInputDto |
|||
{ |
|||
[Required] |
|||
public string Title { get; set; } |
|||
|
|||
[Required] |
|||
public string Url { get; set; } |
|||
|
|||
public string Description { get; set; } |
|||
|
|||
[Required] |
|||
public string Content { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,9 @@ |
|||
using Volo.Abp.Application.Dtos; |
|||
|
|||
namespace Volo.CmsKit.Admin.Pages |
|||
{ |
|||
public class GetPagesInputDto : PagedAndSortedResultRequestDto |
|||
{ |
|||
public string Filter { get; set; } |
|||
} |
|||
} |
|||
@ -1,22 +1,11 @@ |
|||
using System; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.Application.Services; |
|||
|
|||
namespace Volo.CmsKit.Admin.Pages |
|||
{ |
|||
public interface IPageAdminAppService |
|||
public interface IPageAdminAppService : ICrudAppService<PageDto, PageDto, Guid, GetPagesInputDto, CreatePageInputDto, UpdatePageInputDto> |
|||
{ |
|||
Task<PageDto> GetAsync(Guid id); |
|||
|
|||
Task<PageDto> CreatePageAsync(CreatePageInputDto input); |
|||
|
|||
Task<PageDto> CreatePageWithContentAsync(CreatePageWithContentInputDto input); |
|||
|
|||
Task<PageDto> UpdatePageAsync(Guid id, UpdatePageInputDto input); |
|||
|
|||
Task<bool> DoesUrlExistAsync(CheckUrlInputDto input); |
|||
|
|||
Task UpdatePageContentAsync(Guid id, UpdatePageContentInputDto input); |
|||
|
|||
Task DeleteAsync(Guid id); |
|||
Task<bool> ExistsAsync(string url); |
|||
} |
|||
} |
|||
@ -1,17 +0,0 @@ |
|||
using System; |
|||
using Volo.Abp.Application.Dtos; |
|||
using Volo.CmsKit.Admin.Contents; |
|||
|
|||
namespace Volo.CmsKit.Admin.Pages |
|||
{ |
|||
public class PageWithContentDto : EntityDto<Guid> |
|||
{ |
|||
public string Title { get; set; } |
|||
|
|||
public string Url { get; set; } |
|||
|
|||
public string Description { get; set; } |
|||
|
|||
public ContentDto Content { get; set; } |
|||
} |
|||
} |
|||
@ -1,10 +0,0 @@ |
|||
using System.ComponentModel.DataAnnotations; |
|||
|
|||
namespace Volo.CmsKit.Admin.Pages |
|||
{ |
|||
public class UpdatePageContentInputDto |
|||
{ |
|||
[Required] |
|||
public string Content { get; set; } |
|||
} |
|||
} |
|||
@ -1,70 +0,0 @@ |
|||
using System; |
|||
using System.Threading.Tasks; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Volo.Abp; |
|||
using Volo.CmsKit.Admin.Pages; |
|||
|
|||
namespace Volo.CmsKit.Admin.Page |
|||
{ |
|||
[RemoteService(Name = CmsKitCommonRemoteServiceConsts.RemoteServiceName)] |
|||
[Area("cms-kit")] |
|||
[Route("api/cms-kit-admin/pages")] |
|||
public class PageAdminController : CmsKitAdminController, IPageAdminAppService |
|||
{ |
|||
protected readonly IPageAdminAppService PageAdminAppService; |
|||
|
|||
public PageAdminController(IPageAdminAppService pageAdminAppService) |
|||
{ |
|||
PageAdminAppService = pageAdminAppService; |
|||
} |
|||
|
|||
[HttpGet] |
|||
[Route("{id}")] |
|||
public virtual Task<PageDto> GetAsync(Guid id) |
|||
{ |
|||
return PageAdminAppService.GetAsync(id); |
|||
} |
|||
|
|||
[HttpPost] |
|||
[Route("create")] |
|||
public virtual Task<PageDto> CreatePageAsync(CreatePageInputDto input) |
|||
{ |
|||
return PageAdminAppService.CreatePageAsync(input); |
|||
} |
|||
|
|||
[HttpPost] |
|||
[Route("create-with-content")] |
|||
public virtual Task<PageDto> CreatePageWithContentAsync(CreatePageWithContentInputDto input) |
|||
{ |
|||
return PageAdminAppService.CreatePageWithContentAsync(input); |
|||
} |
|||
|
|||
[HttpPut] |
|||
[Route("{id}")] |
|||
public virtual Task<PageDto> UpdatePageAsync(Guid id, UpdatePageInputDto input) |
|||
{ |
|||
return PageAdminAppService.UpdatePageAsync(id, input); |
|||
} |
|||
|
|||
[HttpPost] |
|||
[Route("does-url-exist")] |
|||
public virtual Task<bool> DoesUrlExistAsync(CheckUrlInputDto input) |
|||
{ |
|||
return PageAdminAppService.DoesUrlExistAsync(input); |
|||
} |
|||
|
|||
[HttpPut] |
|||
[Route("update-content/{id}")] |
|||
public virtual Task UpdatePageContentAsync(Guid id, UpdatePageContentInputDto input) |
|||
{ |
|||
return PageAdminAppService.UpdatePageContentAsync(id, input); |
|||
} |
|||
|
|||
[HttpDelete] |
|||
[Route("{id}")] |
|||
public virtual Task DeleteAsync(Guid id) |
|||
{ |
|||
return PageAdminAppService.DeleteAsync(id); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,70 @@ |
|||
using System; |
|||
using System.Threading.Tasks; |
|||
using Microsoft.AspNetCore.Authorization; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Volo.Abp; |
|||
using Volo.Abp.Application.Dtos; |
|||
using Volo.Abp.GlobalFeatures; |
|||
using Volo.CmsKit.GlobalFeatures; |
|||
using Volo.CmsKit.Permissions; |
|||
|
|||
namespace Volo.CmsKit.Admin.Pages |
|||
{ |
|||
[RequiresGlobalFeature(typeof(PagesFeature))] |
|||
[RemoteService(Name = CmsKitCommonRemoteServiceConsts.RemoteServiceName)] |
|||
[Area("cms-kit")] |
|||
[Authorize(CmsKitAdminPermissions.Pages.Default)] |
|||
[Route("api/cms-kit-admin/pages")] |
|||
public class PageAdminController : CmsKitAdminController, IPageAdminAppService |
|||
{ |
|||
protected readonly IPageAdminAppService PageAdminAppService; |
|||
|
|||
public PageAdminController(IPageAdminAppService pageAdminAppService) |
|||
{ |
|||
PageAdminAppService = pageAdminAppService; |
|||
} |
|||
|
|||
[HttpGet] |
|||
[Route("{id}")] |
|||
public virtual Task<PageDto> GetAsync(Guid id) |
|||
{ |
|||
return PageAdminAppService.GetAsync(id); |
|||
} |
|||
|
|||
[HttpGet] |
|||
public virtual Task<PagedResultDto<PageDto>> GetListAsync(GetPagesInputDto input) |
|||
{ |
|||
return PageAdminAppService.GetListAsync(input); |
|||
} |
|||
|
|||
[HttpPost] |
|||
[Authorize(CmsKitAdminPermissions.Pages.Create)] |
|||
public virtual Task<PageDto> CreateAsync(CreatePageInputDto input) |
|||
{ |
|||
return PageAdminAppService.CreateAsync(input); |
|||
} |
|||
|
|||
[HttpPost] |
|||
[Authorize(CmsKitAdminPermissions.Pages.Update)] |
|||
[Route("{id}")] |
|||
public virtual Task<PageDto> UpdateAsync(Guid id, UpdatePageInputDto input) |
|||
{ |
|||
return PageAdminAppService.UpdateAsync(id, input); |
|||
} |
|||
|
|||
[HttpDelete] |
|||
[Authorize(CmsKitAdminPermissions.Pages.Delete)] |
|||
[Route("{id}")] |
|||
public virtual Task DeleteAsync(Guid id) |
|||
{ |
|||
return PageAdminAppService.DeleteAsync(id); |
|||
} |
|||
|
|||
[HttpGet] |
|||
[Route("exists/{url}")] |
|||
public virtual Task<bool> ExistsAsync(string url) |
|||
{ |
|||
return PageAdminAppService.ExistsAsync(url); |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue