Small fixes in Docs

This commit is contained in:
2023-03-08 01:50:55 +01:00
parent afef650b26
commit 417a5f772a
3 changed files with 6 additions and 13 deletions

View File

@ -6,7 +6,7 @@ using System.Threading.Tasks;
using WGneu.Models;
namespace WGneu.Documents {
public class BusinessDocument : Document {
public abstract class BusinessDocument : Document {
public BusinessDocument(string title, Member m) : base(title) {
Member = m;

View File

@ -6,7 +6,7 @@ using System.Threading.Tasks;
using System.IO;
namespace WGneu.Documents {
public class Document {
public abstract class Document {
public Document(string title) {
Title = title;
@ -32,20 +32,13 @@ namespace WGneu.Documents {
private async Task<string> Render() {
if (this is BusinessLetter bl) {
return await Pdf.CompileRenderAsync("BusinessLetter.cshtml", bl);
} else if (this is BusinessDocument bd) {
return await Pdf.CompileRenderAsync("BusinessDocument.cshtml", bd);
} else {
return await Pdf.CompileRenderAsync("Document.cshtml", this);
}
}
private async Task<string> SaveHtml() {
await File.WriteAllTextAsync("razor_test.html", await Render());
return "";
throw new InvalidOperationException();
}
public async Task<string> Save() {
await SaveHtml();
// TODO tempfile
await File.WriteAllTextAsync("razor_test.html", await Render());
return "";
}
}

View File

@ -28,7 +28,7 @@ namespace WGneu {
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseSqlite("Data Source=\"C:\\Users\\tom\\Projects\\wgneu\\wgtest.sqlite3\"; foreign keys=true");
optionsBuilder.UseSqlite("Data Source=\"C:\\Users\\lorenz\\Desktop\\wgtest.sqlite3\"; foreign keys=true");
optionsBuilder.UseLazyLoadingProxies();
}
}