public async Task <ActionResult <AdsImportResultViewModel> > ImportReferential(ImportOptionsViewModel options)
        {
            var extension = System.IO.Path.GetExtension(options.FileName);

            if (string.IsNullOrEmpty(extension))
            {
                return(BadRequest("extension"));
            }

            IList <ExchangeDataRow> models = new
                                             List <ExchangeDataRow>();

            var result = new AdsImportResultViewModel();

            switch (extension)
            {
            case ".xlsx":
            case ".xls":
            {
                using var xlsReader = new XlsReader <ExchangeDataRow>(options);
                models = xlsReader.Read();
                break;
            }

            case ".xml":
            {
                var xmlReader = new XmlReader <ExchangeDataRow>(options);
                models = xmlReader.Read();
                break;
            }

            case ".csv":
            case ".txt":
            {
                var csvReader = new CsvReader <ExchangeDataRow>(options);
                models = csvReader.Read();
                break;
            }
            }

            await StartProcessImportProduct(options, models, result);

            return(Ok(result));
        }
        public async Task Import(ImportOptionsViewModel importOptions)
        {
            var extension = System.IO.Path.GetExtension(importOptions.FileName);

            IList <AdsCategoryViewModel> models = new
                                                  List <AdsCategoryViewModel>();

            if (extension.Equals(".xlsx") || extension.Equals(".xls"))
            {
                using var xlsReader = new XlsReader <AdsCategoryViewModel>(importOptions);
                models = xlsReader.Read();
            }
            else if (extension.Equals(".xml"))
            {
                var xmlReader = new XmlReader <AdsCategoryViewModel>(importOptions);
                models = xmlReader.Read();
                ImportSubCategories(models, xmlReader);
            }

            // await _adsUnitOfWork.CategoriesRepository.Clear();
            // await _adsUnitOfWork.CategoriesRepository.BulkInsertAsync(models);
        }