Projektdateien hinzufügen.
This commit is contained in:
55
Webshop.Domain/Entities/Discount.cs
Normal file
55
Webshop.Domain/Entities/Discount.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Webshop.Domain.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// Verwaltung von Rabatten auf Produkte oder Kategorien.
|
||||
/// </summary>
|
||||
public class Discount
|
||||
{
|
||||
[Key]
|
||||
public Guid Id { get; set; }
|
||||
|
||||
[Required]
|
||||
[MaxLength(255)]
|
||||
public string Name { get; set; }
|
||||
|
||||
[Required]
|
||||
[MaxLength(50)]
|
||||
public string DiscountType { get; set; } // "Percentage", "FixedAmount"
|
||||
|
||||
// Precision wird via Fluent API konfiguriert
|
||||
[Required]
|
||||
public decimal DiscountValue { get; set; }
|
||||
|
||||
[Required]
|
||||
public DateTimeOffset StartDate { get; set; }
|
||||
|
||||
public DateTimeOffset? EndDate { get; set; }
|
||||
|
||||
[Required]
|
||||
public bool IsActive { get; set; }
|
||||
|
||||
[Required]
|
||||
public bool RequiresCouponCode { get; set; }
|
||||
|
||||
// Unique-Constraint wird via Fluent API konfiguriert
|
||||
[MaxLength(50)]
|
||||
public string? CouponCode { get; set; }
|
||||
|
||||
public decimal? MinimumOrderAmount { get; set; }
|
||||
|
||||
public int? MaximumUsageCount { get; set; }
|
||||
|
||||
[Required]
|
||||
public int CurrentUsageCount { get; set; }
|
||||
|
||||
[MaxLength(1000)]
|
||||
public string? Description { get; set; }
|
||||
|
||||
// Navigation Properties
|
||||
public virtual ICollection<ProductDiscount> ProductDiscounts { get; set; } = new List<ProductDiscount>();
|
||||
public virtual ICollection<CategoryDiscount> CategoryDiscounts { get; set; } = new List<CategoryDiscount>();
|
||||
}
|
||||
Reference in New Issue
Block a user