diff --git a/EnvelopeGenerator.ServiceHost/Controllers/DocResultController.cs b/EnvelopeGenerator.ServiceHost/Controllers/DocResultController.cs index bd59b946..920c5902 100644 --- a/EnvelopeGenerator.ServiceHost/Controllers/DocResultController.cs +++ b/EnvelopeGenerator.ServiceHost/Controllers/DocResultController.cs @@ -9,8 +9,13 @@ namespace EnvelopeGenerator.ServiceHost.Controllers; public class DocResultController(IMediator mediator) : ControllerBase { [HttpGet] - public async Task GetAsync([FromQuery] ReadSingleEnvelopeDocResultQuery query, CancellationToken cancel = default) + public async Task GetAsync([FromQuery] ReadSingleEnvelopeDocResultQuery query, [FromQuery] bool download = false, CancellationToken cancel = default) { - return File(await mediator.Send(query, cancel), "application/pdf", $"envelope_{query.Envelope.Uuid}.pdf"); + var bytes = await mediator.Send(query, cancel); + + if (download) + return File(bytes, "application/pdf", $"envelope_{query.Envelope.Uuid}.pdf"); + + return File(bytes, "application/pdf"); } } \ No newline at end of file