From 3a521a782a44cc7e8c0b80358781b66cc12e02b0 Mon Sep 17 00:00:00 2001 From: Hamid Reza Mohammadi Date: Wed, 4 Nov 2020 16:44:10 +0330 Subject: [PATCH] #26 changing audio xml output from file to string --- RMuseum/Controllers/AudioNarrationController.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/RMuseum/Controllers/AudioNarrationController.cs b/RMuseum/Controllers/AudioNarrationController.cs index d0ddfc72..a39b3c5b 100644 --- a/RMuseum/Controllers/AudioNarrationController.cs +++ b/RMuseum/Controllers/AudioNarrationController.cs @@ -107,7 +107,7 @@ namespace RMuseum.Controllers } /// - /// get the corresponding xml file for the narration + /// get the corresponding xml file contemnts (xml) for the narration /// /// /// it could be protected (Authorized), but I guess I would have problems with available client components support, @@ -117,7 +117,7 @@ namespace RMuseum.Controllers /// [HttpGet("file/{id}.xml")] [AllowAnonymous] - [ProducesResponseType((int)HttpStatusCode.OK, Type = typeof(FileStreamResult))] + [ProducesResponseType((int)HttpStatusCode.OK, Type = typeof(string))] [ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))] public async Task GetXMLFile(int id) { @@ -139,7 +139,7 @@ namespace RMuseum.Controllers return StatusCode(StatusCodes.Status304NotModified); } - return new FileStreamResult(new FileStream(narration.Result.LocalXmlFilePath, FileMode.Open, FileAccess.Read), "text/xml"); + return Ok(System.IO.File.ReadAllText(narration.Result.LocalXmlFilePath)); } ///