Mango.Nop.Plugins/Nop.Plugin.Misc.AIPlugin/Areas/Admin/Controllers/FileManagerScriptsApiContro...

46 lines
1.6 KiB
C#

using DevExtreme.AspNet.Mvc.FileManagement;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
namespace Nop.Plugin.Misc.FruitBankPlugin.Areas.Admin.Controllers
{
public class FileManagerScriptsApiController : Controller
{
IWebHostEnvironment _webHostEnvironment;
public FileManagerScriptsApiController(IWebHostEnvironment webHostEnvironment)
{
_webHostEnvironment = webHostEnvironment;
}
[HttpGet]
[HttpPost]
[Route("api/file-manager-file-system", Name = "FileManagementFileSystemApi")]
public object FileSystem(FileSystemCommand command, string arguments, int orderId)
{
string path = Request.Headers["TestHeader"];
var valami = new List<int>();
var config = new FileSystemConfiguration
{
Request = Request,
FileSystemProvider = new PhysicalFileSystemProvider(_webHostEnvironment.ContentRootPath + $"/wwwroot/uploads/orders/order{path}"),
//uncomment the code below to enable file/folder management
//AllowCopy = true,
//AllowCreate = true,
//AllowMove = true,
//AllowDelete = true,
//AllowRename = true,
//AllowUpload = true,
//AllowDownload = true,
AllowedFileExtensions = new[] { ".pdf", ".jpg", ".jpeg" }
};
var processor = new FileSystemCommandProcessor(config);
var result = processor.Execute(command, arguments);
return result.GetClientCommandResult();
}
}
}