public IActionResult OnGet() { ticketToPdf = new TicketToPdf(null); FileName = "Jegyek_" + Orderid + ".pdf"; //Build the File Path. string path = FileName; //Read the File data into Byte Array. byte[] bytes = System.IO.File.ReadAllBytes(path); ticketToPdf.DeletePdf(FileName); //Send the File to Download. return(File(bytes, "application/octet-stream", FileName)); }
public IActionResult DeletePdf(string filename) { ticketToPdf.DeletePdf(filename); return(Ok()); }