quick / InvoiceItem.cs
Ahmedtiger7's picture
Upload 23 files
841722b verified
Raw History Blame Contribute Delete
786 Bytes
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace QuickInvoiceSaaS.Models
{
public class InvoiceItem
{
[Key]
public int Id { get; set; }
[Required]
public int InvoiceId { get; set; }
[ForeignKey(nameof(InvoiceId))]
public Invoice? Invoice { get; set; }
[Required]
[MaxLength(250)]
public string ProductName { get; set; } = string.Empty;
public int Quantity { get; set; } = 1;
[Column(TypeName = "decimal(18,2)")]
public decimal UnitPrice { get; set; }
[Column(TypeName = "decimal(18,2)")]
public decimal LineTotal => Quantity * UnitPrice; // حساب تلقائي
}
}