58 lines
1.6 KiB
C#
58 lines
1.6 KiB
C#
// 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
|
|
{
|
|
public class Address
|
|
{
|
|
[Key]
|
|
public Guid Id { get; set; } = Guid.NewGuid();
|
|
|
|
[ForeignKey(nameof(Customer))]
|
|
public Guid? CustomerId { get; set; } // Verknüpfung zum Kunden
|
|
|
|
[Required]
|
|
[MaxLength(255)]
|
|
public string Street { get; set; } = string.Empty;
|
|
|
|
// << NEUE EIGENSCHAFT HINZUFÜGEN >>
|
|
[MaxLength(50)]
|
|
public string? HouseNumber { get; set; }
|
|
|
|
[Required]
|
|
[MaxLength(100)]
|
|
public string City { get; set; } = string.Empty;
|
|
|
|
[Required]
|
|
[MaxLength(20)]
|
|
public string PostalCode { get; set; } = string.Empty;
|
|
|
|
[Required]
|
|
[MaxLength(100)]
|
|
public string Country { get; set; } = string.Empty;
|
|
|
|
// << NEUE EIGENSCHAFT HINZUFÜGEN >>
|
|
public AddressType Type { get; set; }
|
|
|
|
// Optional: Weitere Felder
|
|
[MaxLength(100)]
|
|
public string? State { get; set; } // Bundesland/Kanton
|
|
|
|
[MaxLength(255)]
|
|
public string? CompanyName { get; set; }
|
|
|
|
[Required]
|
|
[MaxLength(100)]
|
|
public string FirstName { get; set; } = string.Empty;
|
|
|
|
[Required]
|
|
[MaxLength(100)]
|
|
public string LastName { get; set; } = string.Empty;
|
|
|
|
// Navigation Property zum Kunden
|
|
public virtual Customer? Customer { get; set; }
|
|
}
|
|
} |