public async Task <ImportModel> 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 hasErrors = await _blogMlImporter.Import(Security.CurrentUser.Id,
                                                         model.TempFile,
                                                         model.ArticulateNodeId,
                                                         model.Overwrite,
                                                         model.RegexMatch,
                                                         model.RegexReplace,
                                                         model.Publish,
                                                         model.ExportDisqusXml,
                                                         model.ImportFirstImage);

            //cleanup
            File.Delete(model.TempFile);

            if (hasErrors)
            {
                throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Importing failed, see umbraco log for details"));
            }

            return(new ImportModel
            {
                DownloadUrl = Url.GetUmbracoApiService <ArticulateBlogImportController>("GetDisqusExport")
            });
        }
        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("~/App_Data/Temp/Articulate");

            //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"));
            }

            return(new ImportModel
            {
                DownloadUrl = Url.GetUmbracoApiService <ArticulateBlogImportController>("GetDisqusExport")
            });
        }
        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));
        }