public async Task<byte[]> ViewInvoiceLateDocAsync(int invoiceId, int link2docId) { var data = GetLateInvoiceTemplate(invoiceId, link2docId); if (data == null) { throw new InvalidOperationException("Document not found"); } string htmlTemplate = data.TemplateBody; LateInvoiceDoc model = data; HtmlEngineFactory htmlGen = new HtmlEngineFactory(_httpContextAccessor, _viewEngine, _tempDataProvider, _hostingEnvironment); var html = await htmlGen.ToHtml(htmlTemplate, model); return System.Text.Encoding.UTF8.GetBytes(html); }
private async Task<string> GetMessageHtml(string messageTemplate, dynamic model) { var htmlGen = new HtmlEngineFactory(_httpContextAccessor, _viewEngine, _tempDataProvider, _hostingEnvironment); return await htmlGen.ToHtml(messageTemplate, model); }