public void Save(string path, Stream stream)
        {
            var directory = Path.GetDirectoryName(path);

            if (!Directory.Exists(directory))
            {
                Directory.CreateDirectory(directory);
            }
            _fileSave.Save(path, stream);
        }
Ejemplo n.º 2
0
        public async Task <string> Process(IFormFile catalogueFile)
        {
            try
            {
                string fileUniqueGuid = Guid.NewGuid().ToString();
                if (catalogueFile != null)
                {
                    string savedPath = _constructFileStoragePath.GetPath(fileUniqueGuid);
                    await _saveFile.Save(catalogueFile, savedPath);

                    DataTable dtCompanyCatalogue = _fileParser.Parse(savedPath);
                    List <CompanyDetailModel> catalogueDetails = _companyCatalogueCollection.GetCollection(dtCompanyCatalogue);
                    await _catalogueUOW.Create(catalogueDetails, fileUniqueGuid, catalogueFile.FileName);

                    _deleteFile.Delete(savedPath);
                }
                return(fileUniqueGuid);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
        public void SaveFileToUnderProcessingFolder(string fileName, Stream fileStream)
        {
            var filePath = $"{_configuration["StoredUnderProcessingFilesPath"]}{fileName}";

            _saveFile.Save(filePath, fileStream);
        }