40 lines
1.2 KiB
C#
40 lines
1.2 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;
|
|
|
|
public string Description { get; set; } = string.Empty;
|
|
|
|
[Column(TypeName = "decimal(18,2)")]
|
|
public decimal Price { get; set; }
|
|
|
|
[Column(TypeName = "decimal(18,4)")]
|
|
public decimal Weight { get; set; }
|
|
|
|
public ProductWeightUnit WeightUnit { get; set; } = ProductWeightUnit.Kilogram;
|
|
|
|
public int StockQuantity { get; set; } = 0;
|
|
|
|
public Guid CategoryId { get; set; }
|
|
|
|
public bool IsActive { get; set; } = true;
|
|
|
|
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
|
|
|
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
|
|
|
|
// 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>();
|
|
} |