Added file manager DEMO
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
using Step.NC;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.Http;
|
||||
using static CMS_CORE_Library.DataStructures;
|
||||
|
||||
namespace Step.Controllers.WebApi
|
||||
{
|
||||
|
||||
[RoutePrefix("api/file_manager")]
|
||||
|
||||
public class NcFileController : ApiController
|
||||
{
|
||||
|
||||
[Route("files"), HttpGet]
|
||||
public IHttpActionResult GetFileList(string filePath = "")
|
||||
{
|
||||
using (NcHandler ncHandler = new NcHandler())
|
||||
{
|
||||
ncHandler.Connect();
|
||||
|
||||
CmsError cmsError = ncHandler.GetFileList(filePath, out List<PreviewFileModel> fileList);
|
||||
if (cmsError.IsError())
|
||||
return BadRequest(cmsError.localizationKey);
|
||||
|
||||
return Ok(fileList);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Route("file/info/{*filePath}"), HttpGet]
|
||||
public IHttpActionResult GetFileInfo(string filePath)
|
||||
{
|
||||
using (NcHandler ncHandler = new NcHandler())
|
||||
{
|
||||
ncHandler.Connect();
|
||||
|
||||
CmsError cmsError = ncHandler.GetFileInfo(filePath, out InfoFile fileInfo);
|
||||
if (cmsError.IsError())
|
||||
return BadRequest(cmsError.localizationKey);
|
||||
|
||||
return Ok(fileInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user