Gossage dans API
This commit is contained in:
@@ -2,9 +2,7 @@
|
||||
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,
|
||||
@@ -28,5 +26,9 @@ public class Product {
|
||||
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...)
|
||||
}
|
@@ -0,0 +1,27 @@
|
||||
using static GrossesMitainesAPI.Models.Product;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace GrossesMitainesAPI.Models;
|
||||
public class ProductViewModel {
|
||||
public int Id { get; set; }
|
||||
public string Title { get; set; } = "Erreur Aucun Objet";
|
||||
public string Category { get; set; } = "Inconnue";
|
||||
public string Description { get; set; } = "Lorem Ipsum.";
|
||||
public decimal Price { get; set; } = 0;
|
||||
public decimal PromoPrice { get; set; } = 0;
|
||||
public uint Quantity { get; set; } = 0;
|
||||
public States Status { get; set; } = States.Available;
|
||||
public string? ImageName { get; set; }
|
||||
|
||||
public ProductViewModel(Product prod) {
|
||||
this.Id = prod.Id;
|
||||
this.Title = prod.Title;
|
||||
this.Category = prod.Category;
|
||||
this.Description = prod.Description;
|
||||
this.Price = prod.Price;
|
||||
this.PromoPrice = prod.PromoPrice;
|
||||
this.Quantity = prod.Quantity;
|
||||
this.Status = prod.Status;
|
||||
this.ImageName = prod.ImageName;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user