2022-10-09 14:23:46 -04:00
|
|
|
|
using Microsoft.Data.SqlClient.Server;
|
|
|
|
|
using System.ComponentModel.DataAnnotations;
|
2022-10-31 15:11:18 -04:00
|
|
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
2022-10-08 13:22:12 -04:00
|
|
|
|
|
|
|
|
|
namespace GrossesMitainesAPI.Models;
|
2022-10-27 12:37:13 -04:00
|
|
|
|
|
2022-11-01 13:33:08 -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...)
|
2022-10-31 15:11:18 -04:00
|
|
|
|
|
|
|
|
|
[NotMapped]
|
|
|
|
|
public IFormFile? ImageFile { get; set; }
|
2022-10-08 13:22:12 -04:00
|
|
|
|
}
|