public async Task <CatalogueByGuidModel> GetCatalogueByCatalogueId(string catalogueId)
        {
            CatalogueByGuidModel catalogueByGuidModel = null;

            if (!string.IsNullOrWhiteSpace(catalogueId))
            {
                catalogueByGuidModel = await _retrieveCatalogueDetailsRepo.GetCatalogueByGuid(catalogueId);
            }
            return(catalogueByGuidModel);
        }
Exemplo n.º 2
0
        public async Task <ExportModel> Export(string catalogueId)
        {
            try
            {
                CatalogueByGuidModel catalogueDetails = await _retrieveCatalogueDetailsRepo.GetCatalogueByGuid(catalogueId);

                string path = _constructFileStoragePath.GetPath(catalogueId);
                _constructExcelFile.Create(path, catalogueDetails.CompanyDetails);
                byte[] file = File.ReadAllBytes(path);
                _deleteFile.Delete(path);
                ExportModel fileDetails = new ExportModel
                {
                    FileBytes = file,
                    FileName  = catalogueDetails.FileName
                };
                return(fileDetails);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }