public FileContentResult GenerateDemoOrder(OrderModel model) { string orderName = orderPdfService.CreateOrder(model); byte[] bytes = System.IO.File.ReadAllBytes(orderName); System.IO.File.Delete(orderName); return(File(bytes, "application/pdf")); }
// GET: Order/Show/5 public IActionResult Show(Guid id) { OrderEntry orderEntry = GetOrder(id); if (!IsOrderFoundAndCurrentUserHasPermission(orderEntry)) { return(RedirectToAction(nameof(Index))); } string orderName = orderPdfService.CreateOrder(orderEntry.Order); byte[] bytes = System.IO.File.ReadAllBytes(orderName); System.IO.File.Delete(orderName); return(File(bytes, "application/pdf")); }