Skip to content

Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.

685 B
Raw Blame
using Grand.Business.Core.Interfaces.ExportImport;

namespace Grand.Business.Common.Services.ExportImport;

public class ImportManager<T> : IImportManager<T> where T : class
{
    private readonly IImportDataObject<T> _importDataObject;
    private readonly IImportDataProvider _importDataProvider;

    public ImportManager(IImportDataProvider importDataProvider, IImportDataObject<T> importDataObject)
    {
        _importDataProvider = importDataProvider;
        _importDataObject = importDataObject;
    }

    public async Task Import(Stream stream)
    {
        var data = await _importDataProvider.Convert<T>(stream);
        await _importDataObject.Execute(data);
    }
}