Esempio n. 1
0
        public IActionResult GetFileById(int id)
        {
            ScientificPaper sp        = dbContext.ScientificPapers.FirstOrDefault(s => s.Id.Equals(id));
            char            separator = Path.DirectorySeparatorChar;
            string          filepath  = Path.GetFullPath(Path.Combine($"files{separator}", sp.PdfFileName));

            return(new PhysicalFileResult(filepath, "application/pdf"));
        }
Esempio n. 2
0
        public void IndexScientitifPaper(string directory, string filename, ScientificPaper newScientificPaper)
        {
            var base64File = Convert.ToBase64String(File.ReadAllBytes(Path.Combine(directory, "files", filename)));
            var doc        = new ScientificPaperDocument {
                ScientificPaper = newScientificPaper, Content = base64File
            };

            Index(doc, i => i.Index(DEFAULT_INDEX).Pipeline("attachments"));
        }