18 lines
470 B
C#
18 lines
470 B
C#
using Microsoft.AspNetCore.Mvc;
|
|
|
|
namespace Drab;
|
|
|
|
[ApiController]
|
|
public class FileController : ControllerBase
|
|
{
|
|
[HttpGet("/pdf/{filename}")]
|
|
public IActionResult Get([FromRoute] string filename)
|
|
{
|
|
var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Orders", filename);
|
|
|
|
if (!System.IO.File.Exists(filePath))
|
|
return NotFound();
|
|
|
|
return File(System.IO.File.OpenRead(filePath), "application/pdf");
|
|
}
|
|
} |