public async Task<ImportModel> PostImportBlogMl(ImportBlogMlModel model) { if (!ModelState.IsValid) { throw new HttpResponseException(Request.CreateValidationErrorResponse(ModelState)); } //save to Temp folder (base path) var fs = new PhysicalFileSystem(IOHelper.MapPath("~/App_Data/Temp")); //there should only be one file so we'll just use the first one var importer = new BlogMlImporter(ApplicationContext, fs); await importer.Import(Security.CurrentUser.Id, model.TempFile, model.ArticulateNodeId, model.Overwrite, model.RegexMatch, model.RegexReplace, model.Publish, model.ExportDisqusXml); //cleanup File.Delete(model.TempFile); if (importer.HasErrors) { throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Importing failed, see umbraco log for details")); } var mvcUrlHelper = new UrlHelper(new RequestContext()); return new ImportModel { DownloadUrl = mvcUrlHelper.SurfaceAction<ArticulateBlogImportDataController>("DownloadDisqusExport") }; }
public async Task<HttpResponseMessage> PostImportBlogMl(ImportBlogMlModel model) { if (!ModelState.IsValid) { throw new HttpResponseException(Request.CreateValidationErrorResponse(ModelState)); } //there should only be one file so we'll just use the first one var importer = new BlogMlImporter(ApplicationContext); await importer.Import(Security.CurrentUser.Id, model.TempFile, model.ArticulateNodeId, model.Overwrite, model.RegexMatch, model.RegexReplace, model.Publish, model.ExportDisqusXml); //cleanup File.Delete(model.TempFile); if (importer.HasErrors) { return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Importing failed, see umbraco log for details"); } return Request.CreateResponse(HttpStatusCode.OK); }
public ImportModel PostExportBlogMl(ImportBlogMlModel model) { var mvcUrlHelper = new UrlHelper(new RequestContext()); return new ImportModel { DownloadUrl = mvcUrlHelper.SurfaceAction<ArticulateBlogImportDataController>("DownloadDisqusExport") }; }