littleshop/Models/Product.cs
2025-08-20 13:20:19 +01:00

36 lines
1.0 KiB
C#

using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using LittleShop.Enums;
namespace LittleShop.Models;
public class Product
{
[Key]
public Guid Id { get; set; }
[Required]
[StringLength(200)]
public string Name { get; set; } = string.Empty;
[Required]
public string Description { get; set; } = string.Empty;
public ProductWeightUnit ProductWeightUnit { get; set; }
public double ProductWeight { get; set; }
[Column(TypeName = "decimal(18,2)")]
public decimal BasePrice { get; set; }
public Guid CategoryId { get; set; }
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
public bool IsActive { get; set; } = true;
// Navigation properties
public virtual Category Category { get; set; } = null!;
public virtual ICollection<ProductPhoto> Photos { get; set; } = new List<ProductPhoto>();
public virtual ICollection<OrderItem> OrderItems { get; set; } = new List<OrderItem>();
}