GGMM/GrossesMitaines/GrossesMitainesAPI/Models/Product.cs
2022-10-16 17:33:58 -07:00

32 lines
1.2 KiB
C#

using Microsoft.Data.SqlClient.Server;
using System.ComponentModel.DataAnnotations;
namespace GrossesMitainesAPI.Models;
// nom du produit,
// catégories, description, quantité disponible, images, prix normal et
// autres informations pertinentes
public class Product {
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;
[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 string? ImageName { get; set; } // Base pour sortir les images ({ImageName}.jpg , {ImageName}_thumbnail.jpg, etc...)
}