mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-09-19 18:27:55 +08:00
Refactoring ImportExportService:Export
--HG-- branch : dev
This commit is contained in:
@@ -69,12 +69,12 @@ namespace Orchard.ImportExport.Controllers {
|
||||
try {
|
||||
UpdateModel(viewModel);
|
||||
var contentTypesToExport = viewModel.ContentTypes.Where(c => c.IsChecked).Select(c => c.ContentTypeName);
|
||||
var dataExportOptions = new DataExportOptions();
|
||||
var exportOptions = new ExportOptions { ExportMetadata = viewModel.Metadata, ExportSiteSettings = viewModel.SiteSettings };
|
||||
if (viewModel.Data) {
|
||||
dataExportOptions.ExportData = true;
|
||||
dataExportOptions.VersionHistoryOptions = (VersionHistoryOptions)Enum.Parse(typeof(VersionHistoryOptions), viewModel.DataImportChoice, true);
|
||||
exportOptions.ExportData = true;
|
||||
exportOptions.VersionHistoryOptions = (VersionHistoryOptions)Enum.Parse(typeof(VersionHistoryOptions), viewModel.DataImportChoice, true);
|
||||
}
|
||||
var exportFile = _importExportService.Export(contentTypesToExport, dataExportOptions, viewModel.Metadata, viewModel.SiteSettings);
|
||||
var exportFile = _importExportService.Export(contentTypesToExport, exportOptions);
|
||||
Services.Notifier.Information(T("Your export file has been created at <a href=\"{0}\" />", exportFile));
|
||||
|
||||
return RedirectToAction("Export");
|
||||
|
@@ -1,7 +1,9 @@
|
||||
namespace Orchard.ImportExport.Models {
|
||||
public class DataExportOptions {
|
||||
public class ExportOptions {
|
||||
public bool ExportMetadata { get; set; }
|
||||
public bool ExportData { get; set; }
|
||||
public VersionHistoryOptions VersionHistoryOptions { get; set; }
|
||||
public bool ExportSiteSettings { get; set; }
|
||||
}
|
||||
|
||||
public enum VersionHistoryOptions {
|
@@ -46,7 +46,7 @@
|
||||
<ItemGroup>
|
||||
<Compile Include="AdminMenu.cs" />
|
||||
<Compile Include="Controllers\AdminController.cs" />
|
||||
<Compile Include="Models\DataExportOptions.cs" />
|
||||
<Compile Include="Models\ExportOptions.cs" />
|
||||
<Compile Include="Permissions.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Services\IImportExportService.cs" />
|
||||
|
@@ -4,7 +4,7 @@ using Orchard.ImportExport.Models;
|
||||
namespace Orchard.ImportExport.Services {
|
||||
public interface IImportExportService : IDependency {
|
||||
void Import(string recipeText);
|
||||
string Export(IEnumerable<string> contentTypes, DataExportOptions dataExportOptions, bool exportMetadata, bool exportSettings);
|
||||
string Export(IEnumerable<string> contentTypes, ExportOptions exportOptions);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -33,7 +33,7 @@ namespace Orchard.ImportExport.Services {
|
||||
UpdateShell();
|
||||
}
|
||||
|
||||
public string Export(IEnumerable<string> contentTypes, DataExportOptions dataExportOptions, bool exportMetadata, bool exportSettings) {
|
||||
public string Export(IEnumerable<string> contentTypes, ExportOptions exportOptions) {
|
||||
return String.Empty;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user