예제 #1
0
        public IActionResult DownloadInvoice(string orderGuid)
        {
            var order = _orderService.GetByGuid(orderGuid);

            if (order == null || order.UserId != CurrentUser.Id || !CanDownloadInvoice(order))
            {
                return(NotFound());
            }

            var pdfBytes = _pdfService.GetPdfBytes(PrintHelper.GetInvoice(order));

            return(File(pdfBytes, "application/pdf", $"order_invoice_{order.Id}.pdf"));
        }