Added new Models and Razor Template

This commit is contained in:
2023-03-06 02:02:01 +01:00
parent 28c4bbdff0
commit 6326917c95
20 changed files with 562 additions and 19 deletions

View File

@ -1,18 +1,34 @@
using System;
using RazorLight;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using WGneu.Models;
namespace WGneu.Documents {
class Template {
private static readonly string ROOT = @"C:\Users\Lorenz\Desktop\";
private static readonly string ROOT = @"C:\Users\tom\Projects\wgneu\";
public static async void Test() {
await Pdf.Convert(ROOT + "din-5008.html", ROOT + "test.pdf");
Pdf.Display("Test-Dokument", ROOT + "test.pdf");
}
public static async void Generate(WgContext c) {
var engine = new RazorLightEngineBuilder()
.UseFileSystemProject(@"C:\Users\tom\source\repos\wgneu-cs\WGneu\Documents")
.UseMemoryCachingProvider()
.Build();
var model = new TestTemplateModel(c);
string result = await engine.CompileRenderAsync("TestTemplate.cshtml", model);
await File.WriteAllTextAsync(ROOT + "razor_test.html", result);
}
}
}