main
| Rev | Line | |
|---|
| [dfe03b8] | 1 | using System.ComponentModel.DataAnnotations;
|
|---|
| 2 | using System.ComponentModel.DataAnnotations.Schema;
|
|---|
| 3 |
|
|---|
| 4 | namespace StockMaster.Models
|
|---|
| 5 | {
|
|---|
| 6 | [Table("sale_item", Schema = "stock_management")]
|
|---|
| 7 | public class SaleItem
|
|---|
| 8 | {
|
|---|
| 9 | [Column("sale_id")]
|
|---|
| 10 | public int SaleId { get; set; }
|
|---|
| 11 |
|
|---|
| 12 | [ForeignKey("SaleId")]
|
|---|
| 13 | public Sale Sale { 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 price is required")]
|
|---|
| 27 | [Range(0.01, double.MaxValue, ErrorMessage = "Unit price must be greater than 0")]
|
|---|
| 28 | [Column("unit_price_at_sale")]
|
|---|
| 29 | public decimal UnitPriceAtSale { get; set; }
|
|---|
| 30 | }
|
|---|
| 31 | } |
|---|
Note:
See
TracBrowser
for help on using the repository browser.