Introduced the `InvoiceAttachment` entity and its relationship with `ZugferdInvoice` to manage extracted invoice attachments. Updated `AppDbContext` and added a migration to create the `InvoiceAttachments` table with cascading delete behavior and an index for optimized queries. Enhanced the UI to display attachments in `Details.cshtml`, including file type icons, file size, and extraction date. Added a new `ViewAttachment` page to render or download attachments based on their type, with support for XML, plain text, images, and downloads. Implemented `AttachmentViewerService` to determine viewer types and MIME types for attachments. Registered the service in the DI container. Updated `Upload.cshtml.cs` to save extracted attachments to the database. Improved user experience with syntax highlighting for XML files and appropriate messages for unsupported file types.
24 lines
1.2 KiB
C#
24 lines
1.2 KiB
C#
namespace DXApp.TemplateKitProject.Models
|
|
{
|
|
public class ZugferdInvoice
|
|
{
|
|
public int Id { get; set; }
|
|
public string InvoiceNumber { get; set; } = string.Empty;
|
|
public DateTime InvoiceDate { 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; } = 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; } = string.Empty; // "Upload" oder "Email"
|
|
public string ResultFilePath { get; set; } = string.Empty; // Pfad der Result-PDF
|
|
public string GuidelineId { get; set; } = string.Empty; // ZUGFeRD Guideline-ID aus XMP
|
|
|
|
// Navigation Property
|
|
public List<InvoiceAttachment> Attachments { get; set; } = [];
|
|
}
|
|
} |