GGMM/GrossesMitaines/GrossesMitainesAPI/Models/ProductModel.cs

38 lines
1.3 KiB
C#
Raw Normal View History

2022-10-09 14:23:46 -04:00
using Microsoft.Data.SqlClient.Server;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
2022-10-08 13:22:12 -04:00
namespace GrossesMitainesAPI.Models;
2022-10-27 12:37:13 -04:00
public class ProductModel {
2022-10-16 11:25:21 -04:00
public enum States {
Available,
BackOrder,
Unavailable,
Clearance,
Promotion,
Discontinued
}
2022-10-08 13:22:12 -04:00
[Key]
public int Id { get; set; }
[Required, MaxLength(255)]
2022-10-08 13:41:55 -04:00
public string Title { get; set; } = "Erreur Aucun Objet";
2022-10-08 13:22:12 -04:00
[Required]
2022-10-09 14:23:46 -04:00
public string Category { get; set; } = "Inconnue";
[Required]
2022-10-08 13:41:55 -04:00
public string Description { get; set; } = "Lorem Ipsum.";
2022-10-09 14:23:46 -04:00
[Required, Range(0.01, (double)decimal.MaxValue)] // Range qui prend pas les decimals!
2022-11-05 10:55:09 -04:00
public decimal Price { get; set; } = 0.01M;
2022-10-16 20:33:58 -04:00
[Required, Range(0.00, (double)decimal.MaxValue)]
public decimal PromoPrice { get; set; } = 0;
2022-10-09 14:23:46 -04:00
public uint Quantity { get; set; } = 0;
2022-10-16 11:25:21 -04:00
public States Status { get; set; } = States.Available;
2022-10-27 12:37:13 -04:00
public uint Hits { get; set; } = 0;
public uint Sales { get; set; } = 0;
public DateTime? LastSale { get; set; }
public DateTime? LastHit { get; set; }
2022-11-05 10:55:09 -04:00
public string? ImageName { get; set; } = ""; // Base pour sortir les images ({ImageName}.jpg , {ImageName}_thumbnail.jpg, etc...)
[NotMapped]
public IFormFile? ImageFile { get; set; } 
2022-10-08 13:22:12 -04:00
}