mirror of
https://github.com/Theodor-Springmann-Stiftung/hamann-ausgabe-core.git
synced 2025-10-30 01:35:32 +00:00
Möglichkeit zur Angabe eines zeitraumes für die angezeigten Briefe
This commit is contained in:
@@ -343,8 +343,18 @@ public class APIController : Controller {
|
||||
if (!ModelState.IsValid) return BadRequest(ModelState);
|
||||
|
||||
_xmlProvider.SetInProduction(newFile.First());
|
||||
_xmlService.UnUseProduction();
|
||||
|
||||
return Created("/", newFile.First());
|
||||
}
|
||||
|
||||
|
||||
[HttpPost]
|
||||
[Route("API/SetStartEndYear")]
|
||||
[ValidateAntiForgeryToken]
|
||||
[FeatureGate(Features.UploadService, Features.AdminService)]
|
||||
public async Task<IActionResult>? SetStartEndYear(StartEndYear startendyear) {
|
||||
if (startendyear.StartYear > startendyear.EndYear) return BadRequest();
|
||||
_lib.SetStartEndYear(startendyear.StartYear, startendyear.EndYear);
|
||||
return Created("/", "");;
|
||||
}
|
||||
}
|
||||
@@ -44,6 +44,7 @@ public class UploadController : Controller {
|
||||
[FeatureGate(Features.AdminService)]
|
||||
[GenerateAntiforgeryTokenCookie]
|
||||
public IActionResult Index(string? id) {
|
||||
var library = _lib.GetLibrary();
|
||||
var roots = _xmlService.GetRootsList();
|
||||
if (roots == null) return error404();
|
||||
|
||||
@@ -76,20 +77,22 @@ public class UploadController : Controller {
|
||||
}
|
||||
}
|
||||
|
||||
var availableYears = library.MetasByYear.Select(x => x.Key).Union(library.ExcludedMetasByYear.Select(x => x.Key)).ToList();
|
||||
availableYears.Sort();
|
||||
if (id != null) {
|
||||
id = id.ToLower();
|
||||
|
||||
var root = _xmlService.GetRoot(id);
|
||||
if (root == null) return error404();
|
||||
|
||||
var model = new UploadViewModel(root.Type, id, roots, usedFiles);
|
||||
var model = new UploadViewModel(root.Type, id, roots, usedFiles, _lib.GetStartYear(), _lib.GetEndYear(), availableYears);
|
||||
model.ProductionFiles = productionFiles;
|
||||
model.HamannFiles = hamannFiles;
|
||||
model.AvailableFiles = XMLFileHelpers.ToFileModel(_xmlProvider.GetFiles(id), pF, uF);
|
||||
|
||||
return View("~/Views/Admin/Dynamic/Upload.cshtml", model);
|
||||
} else {
|
||||
var model = new UploadViewModel("Upload & Veröffentlichen", id, roots, usedFiles);
|
||||
var model = new UploadViewModel("Upload & Veröffentlichen", id, roots, usedFiles, _lib.GetStartYear(), _lib.GetEndYear(), availableYears);
|
||||
model.ProductionFiles = productionFiles;
|
||||
model.HamannFiles = hamannFiles;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user