Introduced the `ResultFilePath` property in the `ZugferdInvoice` model to store the path of generated result PDFs. Added a new service, `PdfResultPackageService`, to create result PDFs by converting the original PDF to PDF/A-3b format and attaching a report file. Updated `Upload.cshtml` and `Upload.cshtml.cs` to handle and display the `ResultFilePath`. Created a migration to add the `ResultFilePath` column to the database. Updated `Program.cs` to register the new service and added configuration sections in `appsettings.json` for input and output directories. Enhanced error handling and logging for better traceability.
35 lines
1023 B
C#
35 lines
1023 B
C#
using DXApp.TemplateKitProject.Data;
|
|
using DXApp.TemplateKitProject.Services;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
|
|
builder.Services.AddRazorPages();
|
|
|
|
// Datenbank
|
|
var connectionString = builder.Configuration.GetConnectionString("EcmContext")
|
|
?? throw new InvalidOperationException("Connection string 'EcmContext' not found.");
|
|
builder.Services.AddDbContext<AppDbContext>(options =>
|
|
options.UseSqlServer(connectionString));
|
|
|
|
// Services
|
|
builder.Services.AddScoped<PdfAttachmentExtractorService>();
|
|
builder.Services.AddScoped<PdfResultPackageService>();
|
|
builder.Services.AddScoped<ZugferdExtractorService>();
|
|
builder.Services.AddScoped<ZugferdParserService>();
|
|
builder.Services.AddScoped<ZugferdImportService>();
|
|
|
|
var app = builder.Build();
|
|
|
|
if (!app.Environment.IsDevelopment())
|
|
{
|
|
app.UseExceptionHandler("/Error");
|
|
app.UseHsts();
|
|
}
|
|
|
|
app.UseHttpsRedirection();
|
|
app.UseStaticFiles();
|
|
app.UseRouting();
|
|
app.UseAuthorization();
|
|
app.MapRazorPages();
|
|
app.Run(); |