6
Jak zwrócić plik (FileContentResult) w ASP.NET WebAPI
W zwykłym kontrolerze MVC możemy wyprowadzić plik PDF z rozszerzeniem FileContentResult. public FileContentResult Test(TestViewModel vm) { var stream = new MemoryStream(); //... add content to the stream. return File(stream.GetBuffer(), "application/pdf", "test.pdf"); } Ale jak możemy to zmienić w ApiController? [HttpPost] public IHttpActionResult Test(TestViewModel vm) { //... return Ok(pdfOutput); } Oto, …