From 417a5f772a81685053eeb1fcacc31b5bc9c9f817 Mon Sep 17 00:00:00 2001 From: Lorenz Stechauner Date: Wed, 8 Mar 2023 01:50:55 +0100 Subject: [PATCH] Small fixes in Docs --- WGneu/Documents/BusinessDocument.cshtml.cs | 2 +- WGneu/Documents/Document.cshtml.cs | 15 ++++----------- WGneu/WgContext.cs | 2 +- 3 files changed, 6 insertions(+), 13 deletions(-) diff --git a/WGneu/Documents/BusinessDocument.cshtml.cs b/WGneu/Documents/BusinessDocument.cshtml.cs index 322b5d7..a715d37 100644 --- a/WGneu/Documents/BusinessDocument.cshtml.cs +++ b/WGneu/Documents/BusinessDocument.cshtml.cs @@ -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; diff --git a/WGneu/Documents/Document.cshtml.cs b/WGneu/Documents/Document.cshtml.cs index e0a1237..26d19fb 100644 --- a/WGneu/Documents/Document.cshtml.cs +++ b/WGneu/Documents/Document.cshtml.cs @@ -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 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 SaveHtml() { - await File.WriteAllTextAsync("razor_test.html", await Render()); - return ""; + throw new InvalidOperationException(); } public async Task Save() { - await SaveHtml(); + // TODO tempfile + await File.WriteAllTextAsync("razor_test.html", await Render()); return ""; } } diff --git a/WGneu/WgContext.cs b/WGneu/WgContext.cs index 7a862dd..9ebf134 100644 --- a/WGneu/WgContext.cs +++ b/WGneu/WgContext.cs @@ -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(); } }