Added Upload functionality; still a bit janky in selecting the files to use...

This commit is contained in:
schnulller
2022-06-05 21:04:22 +02:00
parent 0d33dcd4e5
commit b5aae5ddf0
27 changed files with 188456 additions and 40 deletions

View File

@@ -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;
}