Adress und shipping
This commit is contained in:
@@ -1,56 +1,58 @@
|
||||
using System;
|
||||
// src/Webshop.Domain/Entities/Address.cs
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Webshop.Domain.Enums; // << WICHTIG: FÜR AddressType >>
|
||||
|
||||
namespace Webshop.Domain.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// Verwendet für Kundenadressen, Rechnungs- und Lieferadressen von Bestellungen oder Lieferanten.
|
||||
/// </summary>
|
||||
public class Address
|
||||
namespace Webshop.Domain.Entities
|
||||
{
|
||||
[Key]
|
||||
public Guid Id { get; set; }
|
||||
public class Address
|
||||
{
|
||||
[Key]
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
|
||||
[ForeignKey(nameof(Customer))]
|
||||
public Guid? CustomerId { get; set; }
|
||||
[ForeignKey(nameof(Customer))]
|
||||
public Guid? CustomerId { get; set; } // Verknüpfung zum Kunden
|
||||
|
||||
[MaxLength(50)]
|
||||
public string? AddressType { get; set; } // z.B. "Billing", "Shipping"
|
||||
[Required]
|
||||
[MaxLength(255)]
|
||||
public string Street { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
[MaxLength(255)]
|
||||
public string Street { get; set; }
|
||||
// << NEUE EIGENSCHAFT HINZUFÜGEN >>
|
||||
[MaxLength(50)]
|
||||
public string? HouseNumber { get; set; }
|
||||
|
||||
[MaxLength(255)]
|
||||
public string? Street2 { get; set; }
|
||||
[Required]
|
||||
[MaxLength(100)]
|
||||
public string City { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
[MaxLength(100)]
|
||||
public string City { get; set; }
|
||||
[Required]
|
||||
[MaxLength(20)]
|
||||
public string PostalCode { get; set; } = string.Empty;
|
||||
|
||||
[MaxLength(100)]
|
||||
public string? State { get; set; }
|
||||
[Required]
|
||||
[MaxLength(100)]
|
||||
public string Country { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
[MaxLength(20)]
|
||||
public string PostalCode { get; set; }
|
||||
// << NEUE EIGENSCHAFT HINZUFÜGEN >>
|
||||
public AddressType Type { get; set; }
|
||||
|
||||
[Required]
|
||||
[MaxLength(100)]
|
||||
public string Country { get; set; }
|
||||
// Optional: Weitere Felder
|
||||
[MaxLength(100)]
|
||||
public string? State { get; set; } // Bundesland/Kanton
|
||||
|
||||
[MaxLength(255)]
|
||||
public string? CompanyName { get; set; }
|
||||
[MaxLength(255)]
|
||||
public string? CompanyName { get; set; }
|
||||
|
||||
[Required]
|
||||
[MaxLength(100)]
|
||||
public string FirstName { get; set; }
|
||||
[Required]
|
||||
[MaxLength(100)]
|
||||
public string FirstName { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
[MaxLength(100)]
|
||||
public string LastName { get; set; }
|
||||
|
||||
// Navigation Property
|
||||
public virtual Customer? Customer { get; set; }
|
||||
[Required]
|
||||
[MaxLength(100)]
|
||||
public string LastName { get; set; } = string.Empty;
|
||||
|
||||
// Navigation Property zum Kunden
|
||||
public virtual Customer? Customer { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user