38 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			38 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
using Microsoft.Data.SqlClient.Server;
 | 
						||
using System.ComponentModel.DataAnnotations;
 | 
						||
using System.ComponentModel.DataAnnotations.Schema;
 | 
						||
 | 
						||
namespace GrossesMitainesAPI.Models;
 | 
						||
 | 
						||
public class ProductModel {
 | 
						||
    public enum States { 
 | 
						||
        Available,
 | 
						||
        BackOrder,
 | 
						||
        Unavailable,
 | 
						||
        Clearance,
 | 
						||
        Promotion,
 | 
						||
        Discontinued
 | 
						||
    }
 | 
						||
    [Key]
 | 
						||
    public int Id { get; set; }
 | 
						||
    [Required, MaxLength(255)]
 | 
						||
    public string Title { get; set; } = "Erreur Aucun Objet";
 | 
						||
    [Required]
 | 
						||
    public string Category { get; set; } = "Inconnue";
 | 
						||
    [Required]
 | 
						||
    public string Description { get; set; } = "Lorem Ipsum.";
 | 
						||
    [Required, Range(0.01, (double)decimal.MaxValue)] // Range qui prend pas les decimals!
 | 
						||
    public decimal Price { get; set; } = 0.01M;
 | 
						||
    [Required, Range(0.00, (double)decimal.MaxValue)]
 | 
						||
    public decimal PromoPrice { get; set; } = 0;
 | 
						||
    public uint Quantity { get; set; } = 0;
 | 
						||
    public States Status { get; set; } = States.Available;
 | 
						||
    public uint Hits { get; set; } = 0;
 | 
						||
    public uint Sales { get; set; } = 0;
 | 
						||
    public DateTime? LastSale { get; set; }
 | 
						||
    public DateTime? LastHit { get; set; }
 | 
						||
    public string? ImageName { get; set; } = ""; // Base pour sortir les images ({ImageName}.jpg , {ImageName}_thumbnail.jpg, etc...)
 | 
						||
 | 
						||
    [NotMapped]
 | 
						||
    public IFormFile? ImageFile { get; set; } 
 | 
						||
} |