public static Table ImportFromFile(HttpPostedFileBase httpPostedFileBase, IImportFileStructure importFileStructure)
        {
            var file = new ImportFile(httpPostedFileBase);
            var fileImporterFactory = new FileImporterFactory(file, importFileStructure);

            return(fileImporterFactory.GetDataTable());
        }
Ejemplo n.º 2
0
        private static IEnumerable <Show> ImportFile(string filePath)
        {
            if (!File.Exists(filePath))
            {
                throw new FileNotFoundException();
            }

            var fileImporter = FileImporterFactory.GetFileImporter(Path.GetExtension(filePath));

            using (var reader = new StreamReader(filePath))
            {
                return(fileImporter.DoImport(reader));
            }
        }