Add ZUGFeRD parsing and invoice storage support

Enhanced `ZugferdInvoice` model with default string values to prevent nulls. Updated `Upload.cshtml` to display parsed invoice data.

Refactored `Upload.cshtml.cs` to handle ZUGFeRD XML parsing and database storage. Introduced `ImportedInvoice` property and buffered file processing with `MemoryStream`.

Extended `ZugferdParserService` to support ZUGFeRD v1, v1.0 FeRD, and v2/Factur-X. Added version-specific parsing methods and namespaces. Improved date and decimal parsing for robustness.

Added database migration (`20260522084606_InitialCreate`) to define `ZugferdInvoices` table. Updated migration snapshot to reflect schema changes.

Fixed localization issue in `Upload.cshtml.cs` error message.
This commit is contained in:
OlgunR
2026-05-22 14:01:07 +02:00
parent d351a3d577
commit c45e837c2b
7 changed files with 361 additions and 30 deletions

View File

@@ -3,17 +3,17 @@
public class ZugferdInvoice
{
public int Id { get; set; }
public string InvoiceNumber { get; set; }
public string InvoiceNumber { get; set; } = string.Empty;
public DateTime InvoiceDate { get; set; }
public string SellerName { get; set; }
public string SellerTaxId { get; set; }
public string BuyerName { get; set; }
public string SellerName { get; set; } = string.Empty;
public string SellerTaxId { get; set; } = string.Empty;
public string BuyerName { get; set; } = string.Empty;
public decimal TotalAmount { get; set; }
public decimal TaxAmount { get; set; }
public string CurrencyCode { get; set; }
public string Iban { get; set; }
public string RawXml { get; set; } // Original-XML zur Sicherheit
public string CurrencyCode { get; set; } = string.Empty;
public string Iban { get; set; } = string.Empty;
public string RawXml { get; set; } = string.Empty; // Original-XML zur Sicherheit
public DateTime ImportedAt { get; set; }
public string SourceType { get; set; } // "Upload" oder "Email"
public string SourceType { get; set; } = string.Empty; // "Upload" oder "Email"
}
}