Added file manager DEMO

This commit is contained in:
Lucio Maranta
2018-07-27 13:33:57 +02:00
parent a2863ca9b5
commit 9259c80154
4 changed files with 72 additions and 0 deletions
@@ -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);
}
}
}
}