Ajout des Key et Required
This commit is contained in:
@@ -1,12 +1,13 @@
|
|||||||
using API.Class;
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using API.Class;
|
||||||
|
|
||||||
namespace API.Models;
|
namespace API.Models;
|
||||||
|
|
||||||
public class Brand
|
public class Brand
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
[Key] public int Id { get; set; }
|
||||||
public string Name { get; set; }
|
[Required, MaxLength(100)] public string Name { get; set; }
|
||||||
|
|
||||||
public int ProductId { get; set; }
|
[Required] public int ProductId { get; set; }
|
||||||
public Product Product { get; set; }
|
[Required] public Product Product { get; set; }
|
||||||
}
|
}
|
@@ -1,11 +1,12 @@
|
|||||||
using API.Class;
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using API.Class;
|
||||||
|
|
||||||
namespace API.Models;
|
namespace API.Models;
|
||||||
|
|
||||||
public class Classification
|
public class Classification
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
[Key] public int Id { get; set; }
|
||||||
public string Label { get; set; }
|
[Required] public string Label { get; set; }
|
||||||
|
|
||||||
public List<Product> Products { get; set; }
|
[Required] public List<Product> Products { get; set; }
|
||||||
}
|
}
|
@@ -1,10 +1,11 @@
|
|||||||
using API.Class;
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using API.Class;
|
||||||
|
|
||||||
namespace API.Models;
|
namespace API.Models;
|
||||||
|
|
||||||
public class Color
|
public class Color
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
[Key] public int Id { get; set; }
|
||||||
public string Label { get; set; }
|
[Required] public string Label { get; set; }
|
||||||
|
|
||||||
}
|
}
|
@@ -1,10 +1,11 @@
|
|||||||
using API.Class;
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using API.Class;
|
||||||
|
|
||||||
namespace API.Models;
|
namespace API.Models;
|
||||||
|
|
||||||
public class Effect
|
public class Effect
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
[Key] public int Id { get; set; }
|
||||||
public string Label { get; set; }
|
[Required] public string Label { get; set; }
|
||||||
|
|
||||||
}
|
}
|
@@ -1,13 +1,14 @@
|
|||||||
using API.Class;
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using API.Class;
|
||||||
|
|
||||||
namespace API.Models;
|
namespace API.Models;
|
||||||
|
|
||||||
public class Material
|
public class Material
|
||||||
{
|
{
|
||||||
public int Id {get; set;}
|
[Key] public int Id {get; set;}
|
||||||
public string Name {get; set;}
|
[Required, MaxLength(100)] public string Name {get; set;}
|
||||||
public int Quantity {get; set;}
|
[Required] public int Quantity {get; set;}
|
||||||
|
|
||||||
public int WarehouseId {get; set;}
|
[Required] public int WarehouseId {get; set;}
|
||||||
public Warehouse Warehouse {get; set;}
|
[Required] public Warehouse Warehouse {get; set;}
|
||||||
}
|
}
|
@@ -1,21 +1,22 @@
|
|||||||
using API.Class;
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using API.Class;
|
||||||
|
|
||||||
namespace API.Models;
|
namespace API.Models;
|
||||||
|
|
||||||
public class Movement
|
public class Movement
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
[Key] public int Id { get; set; }
|
||||||
public DateTime Date { get; set; }
|
[Required] public DateTime Date { get; set; }
|
||||||
public DateTime Start {get; set;}
|
[Required] public DateTime Start {get; set;}
|
||||||
public DateTime Arrival {get; set;}
|
[Required] public DateTime Arrival {get; set;}
|
||||||
public int Quantity {get; set;}
|
[Required] public int Quantity {get; set;}
|
||||||
|
|
||||||
public int ProductId {get; set;}
|
[Required] public int ProductId {get; set;}
|
||||||
public Product Product {get; set;}
|
[Required] public Product Product {get; set;}
|
||||||
|
|
||||||
public int? sourceWarehouse {get; set;}
|
[Required] public int? sourceWarehouse {get; set;}
|
||||||
public Warehouse SourceWarehouse {get; set;}
|
[Required] public Warehouse SourceWarehouse {get; set;}
|
||||||
|
|
||||||
public int? destinationWarehouse {get; set;}
|
[Required] public int? destinationWarehouse {get; set;}
|
||||||
public Warehouse DestinationWarehouse {get; set;}
|
[Required] public Warehouse DestinationWarehouse {get; set;}
|
||||||
}
|
}
|
@@ -7,11 +7,11 @@ namespace API.Models;
|
|||||||
[PrimaryKey(nameof(SupplierId), nameof(ProductId))]
|
[PrimaryKey(nameof(SupplierId), nameof(ProductId))]
|
||||||
public class Price
|
public class Price
|
||||||
{
|
{
|
||||||
public decimal Label { get; set; }
|
[Required] public decimal Label { get; set; }
|
||||||
|
|
||||||
public int SupplierId { get; set; }
|
[Required] public int SupplierId { get; set; }
|
||||||
[Required] public Supplier Supplier { get; set; }
|
[Required] public Supplier Supplier { get; set; }
|
||||||
|
|
||||||
public int ProductId { get; set; }
|
[Required] public int ProductId { get; set; }
|
||||||
[Required] public Product Product { get; set; }
|
[Required] public Product Product { get; set; }
|
||||||
}
|
}
|
@@ -1,31 +1,32 @@
|
|||||||
using API.Class;
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using API.Class;
|
||||||
|
|
||||||
namespace API.Models
|
namespace API.Models
|
||||||
{
|
{
|
||||||
public class Product
|
public class Product
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
[Key] public int Id { get; set; }
|
||||||
public int References { get; set; }
|
[Required] public int References { get; set; }
|
||||||
public string Name { get; set; }
|
[Required, MaxLength(100)] public string Name { get; set; }
|
||||||
public decimal Duration {get; set;}
|
[Required] public decimal Duration {get; set;}
|
||||||
public decimal Caliber { get; set; }
|
[Required] public decimal Caliber { get; set; }
|
||||||
public int ApprovalNumber { get; set; }
|
[Required] public int ApprovalNumber { get; set; }
|
||||||
public decimal Weight { get; set; }
|
[Required] public decimal Weight { get; set; }
|
||||||
public decimal Nec { get; set; }
|
[Required] public decimal Nec { get; set; }
|
||||||
public decimal SellingPrice { get; set; }
|
[Required] public decimal SellingPrice { get; set; }
|
||||||
public string Image { get; set; }
|
[Required] public string Image { get; set; }
|
||||||
public string Link { get; set; }
|
[Required] public string Link { get; set; }
|
||||||
|
|
||||||
// Relations
|
// Relations
|
||||||
public int ClassificationId { get; set; }
|
[Required] public int ClassificationId { get; set; }
|
||||||
public Classification Classification { get; set; }
|
[Required] public Classification Classification { get; set; }
|
||||||
|
|
||||||
public int ProductCategoryId { get; set; }
|
[Required] public int ProductCategoryId { get; set; }
|
||||||
public ProductCategory ProductCategory { get; set; }
|
[Required] public ProductCategory ProductCategory { get; set; }
|
||||||
|
|
||||||
public List<Brand> Brands { get; set; }
|
[Required] public List<Brand> Brands { get; set; }
|
||||||
|
|
||||||
public List<Movement> Movements { get; set; }
|
[Required] public List<Movement> Movements { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -1,11 +1,12 @@
|
|||||||
using API.Class;
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using API.Class;
|
||||||
|
|
||||||
namespace API.Models;
|
namespace API.Models;
|
||||||
|
|
||||||
public class ProductCategory
|
public class ProductCategory
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
[Key] public int Id { get; set; }
|
||||||
public string Label { get; set; }
|
[Required] public string Label { get; set; }
|
||||||
|
|
||||||
public List<Product> Products { get; set; }
|
[Required] public List<Product> Products { get; set; }
|
||||||
}
|
}
|
@@ -6,9 +6,9 @@ namespace API.Models;
|
|||||||
[PrimaryKey(nameof(ProductId), nameof(ColorId))]
|
[PrimaryKey(nameof(ProductId), nameof(ColorId))]
|
||||||
public class ProductColor
|
public class ProductColor
|
||||||
{
|
{
|
||||||
public Product? Product { get; set; }
|
[Required] public Product? Product { get; set; }
|
||||||
[Required] public int ProductId { get; set; }
|
[Required] public int ProductId { get; set; }
|
||||||
|
|
||||||
public Color? Color { get; set; }
|
[Required] public Color? Color { get; set; }
|
||||||
[Required] public int ColorId { get; set; }
|
[Required] public int ColorId { get; set; }
|
||||||
}
|
}
|
@@ -6,10 +6,10 @@ namespace API.Models;
|
|||||||
[PrimaryKey(nameof(ProductId), nameof(EffectId))]
|
[PrimaryKey(nameof(ProductId), nameof(EffectId))]
|
||||||
public class ProductEffect
|
public class ProductEffect
|
||||||
{
|
{
|
||||||
public Product? Product { get; set; }
|
[Required] public Product? Product { get; set; }
|
||||||
[Required] public int ProductId { get; set; }
|
[Required] public int ProductId { get; set; }
|
||||||
|
|
||||||
public Effect? Effect { get; set; }
|
[Required] public Effect? Effect { get; set; }
|
||||||
[Required] public int EffectId { get; set; }
|
[Required] public int EffectId { get; set; }
|
||||||
|
|
||||||
}
|
}
|
@@ -1,15 +1,16 @@
|
|||||||
using API.Models;
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using API.Models;
|
||||||
|
|
||||||
namespace API.Class;
|
namespace API.Class;
|
||||||
|
|
||||||
public class Supplier
|
public class Supplier
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
[Key] public int Id { get; set; }
|
||||||
public string Name { get; set; }
|
[Required, MaxLength(100)] public string Name { get; set; }
|
||||||
public string Email { get; set; }
|
[Required] public string Email { get; set; }
|
||||||
public string PhoneNumber { get; set; }
|
[Required] public string PhoneNumber { get; set; }
|
||||||
public string Adress { get; set; }
|
[Required] public string Adress { get; set; }
|
||||||
public int ZipCode { get; set; }
|
[Required] public int ZipCode { get; set; }
|
||||||
public string City { get; set; }
|
[Required] public string City { get; set; }
|
||||||
|
|
||||||
}
|
}
|
@@ -1,22 +1,23 @@
|
|||||||
using API.Models;
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using API.Models;
|
||||||
|
|
||||||
namespace API.Class;
|
namespace API.Class;
|
||||||
|
|
||||||
public class Warehouse
|
public class Warehouse
|
||||||
{
|
{
|
||||||
public int Id {get; set;}
|
[Key] public int Id {get; set;}
|
||||||
public string Name {get; set;}
|
[Required, MaxLength(100)] public string Name {get; set;}
|
||||||
public int MaxWeight {get; set;}
|
[Required] public int MaxWeight {get; set;}
|
||||||
public int Current {get; set;}
|
[Required] public int Current {get; set;}
|
||||||
public int MinWeight {get; set;}
|
[Required] public int MinWeight {get; set;}
|
||||||
public string Adress { get; set; }
|
[Required] public string Adress { get; set; }
|
||||||
public int ZipCode { get; set; }
|
[Required] public int ZipCode { get; set; }
|
||||||
public string City { get; set; }
|
[Required] public string City { get; set; }
|
||||||
|
|
||||||
|
|
||||||
public List<Material> Materials {get; set;}
|
[Required] public List<Material> Materials {get; set;}
|
||||||
|
|
||||||
|
|
||||||
public List<Movement> MovementsSource { get; set; }
|
[Required] public List<Movement> MovementsSource { get; set; }
|
||||||
public List<Movement> MovementsDestination { get; set; }
|
[Required] public List<Movement> MovementsDestination { get; set; }
|
||||||
}
|
}
|
@@ -5,11 +5,11 @@ namespace API.Models;
|
|||||||
|
|
||||||
public class WarehouseProduct
|
public class WarehouseProduct
|
||||||
{
|
{
|
||||||
public int Quantity { get; set; }
|
[Key] public int Quantity { get; set; }
|
||||||
|
|
||||||
public int ProductId { get; set; }
|
[Required] public int ProductId { get; set; }
|
||||||
[Required] public Product Product { get; set; }
|
[Required] public Product Product { get; set; }
|
||||||
|
|
||||||
public int WarehouseId { get; set; }
|
[Required] public int WarehouseId { get; set; }
|
||||||
[Required] public Warehouse Warehouse { get; set; }
|
[Required] public Warehouse Warehouse { get; set; }
|
||||||
}
|
}
|
Reference in New Issue
Block a user