[ApiController]
[Route("api/[controller]")]
public class DownloadFileController : ControllerBase
{
[HttpGet]
public IActionResult GetFile([FromQuery] int a, [FromQuery] int b, [FromQuery] int c)
{
// Use the parameters a, b, and c to generate or fetch the file
byte[] fileBytes = GenerateFile(a, b, c);
// Return the file as a download
return File(fileBytes, "application/octet-stream", "MyFile.txt");
}
private byte[] GenerateFile(int a, int b, int c)
{
// Generate or fetch the file, using the arguments a, b, and c
return Encoding.ASCII.GetBytes($"File with parameters a={a}, b={b}, c={c}");
}
}