Example #1
0
        public ActionResult UploadResource(string themeName, string container)
        {
            if (this.Request.Files.Count > 1)
            {
                return this.AjaxFail("Only single file may be uploaded", HttpStatusCode.BadRequest);
            }

            var file = this.Request.Files[0];
            if (file == null)
            {
                return this.AjaxFail("No file was uploaded", HttpStatusCode.BadRequest);
            }

            try
            {
                var uploader = new ResourceUploader(file, themeName, container);
                uploader.Upload();
            }
            catch (ResourceUploadException ex)
            {
                return this.AjaxFail(ex.Message, HttpStatusCode.InternalServerError);
            }

            return Json(new {success = true}, JsonRequestBehavior.AllowGet);
        }
Example #2
0
        public ActionResult UploadResource(string themeName, string container)
        {
            if(this.Request.Files.Count > 1)
            {
                return this.Failed("Only single file may be uploaded", HttpStatusCode.BadRequest);
            }

            var file = this.Request.Files[0];
            if(file == null)
            {
                return this.Failed("No file was uploaded", HttpStatusCode.BadRequest);
            }

            try
            {
                var uploader = new ResourceUploader(file, themeName, container);
                uploader.Upload(this.Tenant);
            }
            catch(ResourceUploadException ex)
            {
                return this.Failed(ex.Message, HttpStatusCode.InternalServerError);
            }

            return this.Ok();
        }