using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using UEditor.Core;

namespace Hncore.Pass.OSS.Controllers
{
    [Route("api/ueditor")]
    [AllowAnonymous]    
    public class UEditorController : Controller
    {
        private readonly UEditorService _ueditorService;
        public UEditorController(UEditorService ueditorService)
        {
            this._ueditorService = ueditorService;
        }

        [HttpGet, HttpPost]
        public ContentResult Upload()
        {
            var response = _ueditorService.UploadAndGetResponse(this.Request.HttpContext);
            return Content(response.Result, response.ContentType);
        }

    }
}