List <Document> IDownloadService.DownloadDocuments(List <Document> request) { //Use DXC Logger MyLogger.Logger dLogger = new MyLogger.Logger(@"C:\Ben\Log4Net\log4net.config", "Ben.Demo.WCF", Guid.NewGuid().ToString()); dLogger.Info("Donload begin"); List <Document> docs = new List <Document>(); foreach (var doc in request) { string filePath = Path.Combine(Constant.WcfDocStore, doc.FileName); byte[] content = File.ReadAllBytes(filePath); Document docResp = new Document(); docResp.FileName = doc.FileName; docResp.Content = content; docs.Add(docResp); } dLogger.Info("Download end"); return(docs); }
List <Document> IUploadService.UploadDocuments(List <Document> documents) { //Use DXC Logger MyLogger.Logger dLogger = new MyLogger.Logger(@"C:\Ben\Log4Net\log4net.config", "Ben.Demo.WCF", Guid.NewGuid().ToString()); dLogger.Info("UploadDocuments begin"); List <Document> docs = new List <Document>(); //store documents into file foreach (var doc in documents) { string fileName = Guid.NewGuid().ToString() + ".pdf"; string filePath = Path.Combine(Constant.WcfDocStore, fileName); //write to path; File.WriteAllBytes(filePath, doc.Content); Document docResp = new Document(); docResp.FileName = fileName; docs.Add(docResp); } dLogger.Info("UploadDocuments finish"); return(docs); }