ASP.NET / ASP.NET E-commerce Website Using Vue / DAL / DomainClasses / Order.cs
Order.cs
Raw
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;

namespace Casestudy.DAL.DomainClasses
{
    public class Order
    {
        [Key]
        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public int Id { get; set; }
        public DateTime OrderDate { get; set; }
        [Column(TypeName = "money")]
        public decimal OrderAmount { get; set; }
        [ForeignKey("CustomerId")]
        public Customer? Customer { get; set; }
        [Required]
        public int CustomerId { get; set; } // needs to be a FK
    }
}