Projektdateien hinzufügen.
This commit is contained in:
47
Webshop.Domain/Entities/OrderItem.cs
Normal file
47
Webshop.Domain/Entities/OrderItem.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Webshop.Domain.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// Die einzelnen Artikel innerhalb einer Bestellung.
|
||||
/// </summary>
|
||||
public class OrderItem
|
||||
{
|
||||
[Key]
|
||||
public Guid Id { get; set; }
|
||||
|
||||
[Required]
|
||||
[ForeignKey(nameof(Order))]
|
||||
public Guid OrderId { get; set; }
|
||||
|
||||
[ForeignKey(nameof(Product))]
|
||||
public Guid? ProductId { get; set; }
|
||||
|
||||
[ForeignKey(nameof(ProductVariant))]
|
||||
public Guid? ProductVariantId { get; set; }
|
||||
|
||||
[Required]
|
||||
[MaxLength(255)]
|
||||
public string ProductName { get; set; } // Snapshot
|
||||
|
||||
[Required]
|
||||
[MaxLength(50)]
|
||||
public string ProductSKU { get; set; } // Snapshot
|
||||
|
||||
[Required]
|
||||
public int Quantity { get; set; }
|
||||
|
||||
// Precision wird via Fluent API konfiguriert
|
||||
[Required]
|
||||
public decimal UnitPrice { get; set; }
|
||||
|
||||
[Required]
|
||||
public decimal TotalPrice { get; set; }
|
||||
|
||||
// Navigation Properties
|
||||
public virtual Order Order { get; set; }
|
||||
public virtual Product? Product { get; set; }
|
||||
public virtual ProductVariant? ProductVariant { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user