main
| Line | |
|---|
| 1 | using System.ComponentModel.DataAnnotations;
|
|---|
| 2 | using System.ComponentModel.DataAnnotations.Schema;
|
|---|
| 3 |
|
|---|
| 4 | namespace StockMaster.Models
|
|---|
| 5 | {
|
|---|
| 6 | [Table("purchase_order_item", Schema = "stock_management")]
|
|---|
| 7 | public class PurchaseOrderItem
|
|---|
| 8 | {
|
|---|
| 9 | [Column("po_id")]
|
|---|
| 10 | public int PoId { get; set; }
|
|---|
| 11 |
|
|---|
| 12 | [ForeignKey("PoId")]
|
|---|
| 13 | public PurchaseOrder PurchaseOrder { get; set; }
|
|---|
| 14 |
|
|---|
| 15 | [Column("product_id")]
|
|---|
| 16 | public int ProductId { get; set; }
|
|---|
| 17 |
|
|---|
| 18 | [ForeignKey("ProductId")]
|
|---|
| 19 | public Product Product { get; set; }
|
|---|
| 20 |
|
|---|
| 21 | [Required(ErrorMessage = "Quantity is required")]
|
|---|
| 22 | [Range(1, int.MaxValue, ErrorMessage = "Quantity must be greater than 0")]
|
|---|
| 23 | [Column("quantity")]
|
|---|
| 24 | public int Quantity { get; set; }
|
|---|
| 25 |
|
|---|
| 26 | [Required(ErrorMessage = "Unit cost is required")]
|
|---|
| 27 | [Range(0.01, double.MaxValue, ErrorMessage = "Unit cost must be greater than 0")]
|
|---|
| 28 | [Column("unit_cost")]
|
|---|
| 29 | public decimal UnitCost { get; set; }
|
|---|
| 30 |
|
|---|
| 31 | [Column("received_quantity")]
|
|---|
| 32 | public int ReceivedQuantity { get; set; } = 0;
|
|---|
| 33 | }
|
|---|
| 34 | } |
|---|
Note:
See
TracBrowser
for help on using the repository browser.