|
|
|
@ -1,6 +1,7 @@ |
|
|
|
using System; |
|
|
|
using System.Threading.Tasks; |
|
|
|
using Microsoft.AspNetCore.Authorization; |
|
|
|
using Microsoft.AspNetCore.Http; |
|
|
|
using Microsoft.AspNetCore.Mvc; |
|
|
|
using Volo.Abp; |
|
|
|
using Volo.Abp.Application.Dtos; |
|
|
|
@ -69,12 +70,28 @@ namespace Volo.CmsKit.Admin.Pages |
|
|
|
} |
|
|
|
|
|
|
|
[HttpPost] |
|
|
|
[Route("set-image/{id}")] |
|
|
|
public virtual Task SetImageAsync(Guid id, [FromBody]RemoteStreamContent content) |
|
|
|
[Authorize(CmsKitAdminPermissions.Pages.Update)] |
|
|
|
[Route("image/{id}")] |
|
|
|
public virtual Task SetImageAsync(Guid id, RemoteStreamContent content) |
|
|
|
{ |
|
|
|
return PageAdminAppService.SetImageAsync(id, content); |
|
|
|
} |
|
|
|
|
|
|
|
[HttpPost] |
|
|
|
[Authorize(CmsKitAdminPermissions.Pages.Update)] |
|
|
|
[Route("upload-image/{id}")] |
|
|
|
public virtual async Task<IActionResult> UploadImageAsync(Guid id, IFormFile file) |
|
|
|
{ |
|
|
|
if (file == null || file.Length == 0) |
|
|
|
{ |
|
|
|
return BadRequest(); |
|
|
|
} |
|
|
|
|
|
|
|
await PageAdminAppService.SetImageAsync(id, new RemoteStreamContent(file.OpenReadStream())); |
|
|
|
|
|
|
|
return StatusCode(201); |
|
|
|
} |
|
|
|
|
|
|
|
[HttpGet] |
|
|
|
[Route("image/{id}")] |
|
|
|
public virtual Task<RemoteStreamContent> GetImageAsync(Guid id) |
|
|
|
|