27 lines
918 B
C#
27 lines
918 B
C#
using Shared.DTOs;
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
namespace Back.Data.Models
|
|
{
|
|
|
|
public class Order
|
|
{
|
|
public int ID { get; set; }
|
|
public int CompanyID { get; set; }
|
|
public int UserID { get; set; }
|
|
public StatusOrder Status { get; set; }
|
|
public string DateCreate { get; set; }
|
|
public string ApprovalDate { get; set; }
|
|
public decimal PreDiscount { get { return OrderItems.Sum(s => s.Total); } }
|
|
public decimal TDiscount { get; set; } = 0;
|
|
public decimal TPrice { get { return OrderItems.Sum(s => s.Total) - TDiscount; } }
|
|
|
|
#region Navigation
|
|
[ForeignKey("CompanyID")]
|
|
public virtual Company Company { get; set; }
|
|
[ForeignKey("UserID")]
|
|
public virtual User User { get; set; }
|
|
public virtual ICollection<OrderItem> OrderItems { get; set; }
|
|
#endregion
|
|
}
|
|
}
|