Ejemplo n.º 1
0
        public IActionResult GetById([FromRoute] string documentId)
        {
            var document = processor.GetDocument(documentId);

            if (document == null || document.Buffer == null)
            {
                return(NotFound());
            }
            var fileContents = document.Buffer.ToMemoryStream();
            var contentType  = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";

            Response.Headers.Add("Access-Control-Expose-Headers", "Content-Disposition");
            return(new FileContentResult(fileContents.ToArray(), contentType)
            {
                FileDownloadName = document.FileName
            });
        }