Beispiel #1
0
        public string UploadImage(string reference, long id, ICollection <IFormFile> file)
        {
            var context    = new ContextImplement(files: file);
            var controller = new Pleasanter.Controllers.BinariesController();
            var json       = controller.UploadImage(context: context, reference: reference, id: id, file: HttpPostedFile.Create(file));

            return(json);
        }
Beispiel #2
0
        public string DeleteSiteImage(string reference, long id)
        {
            var context    = new ContextImplement();
            var controller = new Pleasanter.Controllers.BinariesController();
            var json       = controller.DeleteSiteImage(context: context, reference: reference, id: id);

            return(json);
        }
Beispiel #3
0
        public string DeleteTenantImage()
        {
            var context    = new ContextImplement();
            var controller = new Pleasanter.Controllers.BinariesController();
            var json       = controller.DeleteTenantImage(context: context);

            return(json);
        }
Beispiel #4
0
        public ActionResult TenantImageLogo()
        {
            var context     = new ContextImplement();
            var controller  = new Pleasanter.Controllers.BinariesController();
            var fileContent = controller.TenantImageLogo(context: context);

            return(((System.Web.Mvc.FileContentResult)fileContent).ToFileContentResult());
        }
Beispiel #5
0
        public string UpdateTenantImage(ICollection <IFormFile> file)
        {
            var context    = new ContextImplement(files: file);
            var controller = new Pleasanter.Controllers.BinariesController();
            var json       = controller.UpdateTenantImage(context: context, file: HttpPostedFile.Create(file));

            return(json);
        }
Beispiel #6
0
        public ActionResult SiteImageIcon(string reference, long id)
        {
            var context     = new ContextImplement();
            var controller  = new Pleasanter.Controllers.BinariesController();
            var fileContent = controller.SiteImageIcon(context: context, reference: reference, id: id);

            return(((System.Web.Mvc.FileContentResult)fileContent).ToFileContentResult());
        }
Beispiel #7
0
        public ActionResult ShowTemp(string reference, string guid)
        {
            var context     = new ContextImplement();
            var controller  = new Pleasanter.Controllers.BinariesController();
            var fileContent = controller.ShowTemp(context: context, reference: reference, guid: guid);

            return(fileContent != null
                ? File(fileContent.FileContents, fileContent.ContentType)
                : null);
        }
Beispiel #8
0
        public ActionResult Show(string reference, string guid)
        {
            var context    = new ContextImplement();
            var controller = new Pleasanter.Controllers.BinariesController();
            var file       = controller.Show(context: context, reference: reference, guid: guid);

            if (file == null)
            {
                return(RedirectToAction("notfound", "errors"));
            }
            return(File(file.FileContents, file.ContentType));
        }
Beispiel #9
0
        public ActionResult DownloadTemp(string reference, string guid)
        {
            var context    = new ContextImplement();
            var controller = new Pleasanter.Controllers.BinariesController();
            var file       = controller.DownloadTemp(context: context, reference: reference, guid: guid);

            if (file == null)
            {
                return(RedirectToAction("notfound", "errors"));
            }
            return(ConvertToFileStreamResult(file));
        }
Beispiel #10
0
        public ActionResult Upload(long id)
        {
            var files              = Request.Form.Files;
            var context            = new ContextImplement(files: files.ToList());
            var controller         = new Pleasanter.Controllers.BinariesController();
            var contentRangeHeader = Request.Headers["Content-Range"];
            var matches            = System.Text.RegularExpressions.Regex.Matches(contentRangeHeader.FirstOrDefault() ?? string.Empty, "\\d+");
            var contentRange       = matches.Count > 0
                ? new System.Net.Http.Headers.ContentRangeHeaderValue(
                long.Parse(matches[0].Value),
                long.Parse(matches[1].Value),
                long.Parse(matches[2].Value))
                : null;
            var content = controller.Upload(context: context, id: id, contentRange: contentRange);

            return(new ContentResult()
            {
                Content = content,
                ContentType = "applicaion/json",
            });
        }