public void shouldSuccessPDFTemplateWithPPNandPPH() { VBRealizationDocumentPOPDFTemplate PdfTemplate = new VBRealizationDocumentPOPDFTemplate(); MemoryStream result = PdfTemplate.GeneratePdfTemplate(TemplatePDFDocumentWithPPNandPPH, 7); Assert.NotNull(result); }
public void shouldSuccessPDFTemplateMoreThanOne() { VBRealizationDocumentPOPDFTemplate PdfTemplate = new VBRealizationDocumentPOPDFTemplate(); MemoryStream result = PdfTemplate.GeneratePdfTemplate(TemplatePDFDocumentWithPOItemMoreThanOne, 7); Assert.NotNull(result); }
public IActionResult GetPDFPO([FromRoute] int id) { try { var indexAcceptPdf = Request.Headers["Accept"].ToList().IndexOf("application/pdf"); int timeoffsset = Convert.ToInt32(Request.Headers["x-timezone-offset"]); var data = _service.ReadModelById(id); if (data == null) { Dictionary <string, object> Result = new ResultFormatter(ApiVersion, General.NOT_FOUND_STATUS_CODE, General.NOT_FOUND_MESSAGE) .Fail(); return(NotFound(Result)); } else { VBRealizationDocumentPOPDFTemplate PdfTemplate = new VBRealizationDocumentPOPDFTemplate(); MemoryStream stream = PdfTemplate.GeneratePdfTemplate(data, timeoffsset); return(new FileStreamResult(stream, "application/pdf") { FileDownloadName = $"Realisasi VB Dengan PO - {data.Header.DocumentNo}.pdf" }); } } catch (Exception e) { Dictionary <string, object> Result = new ResultFormatter(ApiVersion, General.INTERNAL_ERROR_STATUS_CODE, e.Message) .Fail(); return(StatusCode(General.INTERNAL_ERROR_STATUS_CODE, Result)); } }