46 lines
1.2 KiB
C#
46 lines
1.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.IO;
|
|
|
|
namespace WGneu.Documents {
|
|
public abstract class Document {
|
|
|
|
public Document(string title) {
|
|
Title = title;
|
|
Header = "Winzergenossenschaft Matzen";
|
|
Footer = "Winzergenossenschaft für Matzen und Umgebung reg. Gen.m.b.H.";
|
|
Date = DateTime.Today;
|
|
}
|
|
|
|
public string Title { get; set; }
|
|
|
|
public string Header { get; set; }
|
|
|
|
public string Footer { get; set; }
|
|
|
|
public string FullDateString {
|
|
get {
|
|
return Date.ToString("dddd, d. MMMM yyyy");
|
|
}
|
|
}
|
|
|
|
public DateTime Date { get; set; }
|
|
|
|
private async Task<string> Render() {
|
|
if (this is BusinessLetter bl) {
|
|
return await Pdf.CompileRenderAsync("BusinessLetter.cshtml", bl);
|
|
}
|
|
throw new InvalidOperationException();
|
|
}
|
|
|
|
public async Task<string> Save() {
|
|
// TODO tempfile
|
|
await File.WriteAllTextAsync("razor_test.html", await Render());
|
|
return "";
|
|
}
|
|
}
|
|
}
|