mirror of
https://github.com/Theodor-Springmann-Stiftung/hamann-ausgabe-core.git
synced 2025-10-29 09:15:33 +00:00
Added Upload functionality; still a bit janky in selecting the files to use...
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
namespace HaWeb.FileHelpers;
|
||||
using HaDocument.Interfaces;
|
||||
using Microsoft.AspNetCore.Mvc.ModelBinding;
|
||||
|
||||
public class HaDocumentWrapper : IHaDocumentWrappper {
|
||||
public ILibrary Library;
|
||||
@@ -13,6 +14,18 @@ public class HaDocumentWrapper : IHaDocumentWrappper {
|
||||
return Library;
|
||||
}
|
||||
|
||||
public ILibrary? SetLibrary(string filepath, ModelStateDictionary ModelState) {
|
||||
try
|
||||
{
|
||||
Library = HaDocument.Document.Create(new HaWeb.Settings.HaDocumentOptions() { HamannXMLFilePath = filepath });
|
||||
}
|
||||
catch (Exception ex) {
|
||||
ModelState.AddModelError("Error:", "Das Dokument konnte nicht geparst werden: " + ex.Message);
|
||||
return null;
|
||||
}
|
||||
return Library;
|
||||
}
|
||||
|
||||
public ILibrary GetLibrary() {
|
||||
return Library;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user