41 lines
1.2 KiB
C#
41 lines
1.2 KiB
C#
using System.Net;
|
|
using System.Threading.Tasks;
|
|
using System.Web.Mvc;
|
|
using Backload.Helper;
|
|
using Umbraco.Web.Mvc;
|
|
|
|
namespace LeafWeb.WebCms.Controllers
|
|
{
|
|
/// <summary>
|
|
/// The integrated controller to handle file requests.
|
|
/// You can remove this code, if you have a custom controller or handler.
|
|
/// </summary>
|
|
public class BackloadController : SurfaceController
|
|
{
|
|
|
|
/// <summary>
|
|
/// The Backload file handler.
|
|
/// To access it in an Javascript ajax request use: <code>var url = "/{Application}/Backload/FileHandler/";</code>.
|
|
/// </summary>
|
|
//[AcceptVerbs(HttpVerbs.Get | HttpVerbs.Post | HttpVerbs.Put | HttpVerbs.Delete | HttpVerbs.Options)]
|
|
public async Task<ActionResult> FileHandler()
|
|
{
|
|
try
|
|
{
|
|
// Create and initialize the handler
|
|
var handler = Backload.FileHandler.Create();
|
|
handler.Init(System.Web.HttpContext.Current.Request);
|
|
|
|
// Call the execution pipeline and get the result
|
|
var result = await handler.Execute();
|
|
|
|
// Helper to create an ActionResult object from the IBackloadResult instance
|
|
return ResultCreator.Create(result);
|
|
}
|
|
catch
|
|
{
|
|
return new HttpStatusCodeResult(HttpStatusCode.InternalServerError);
|
|
}
|
|
}
|
|
}
|
|
} |