I have 3 entities
public class Sale
{
public Sale()
{
SalesDetails = new List<SalesDetail>();
}
[Key]
public int SaleId { get; set; }
public DateTime DateAdded { get; set; }
public decimal Total { get; set; }
public decimal Discount { get; set; }
public decimal FinalTotal { get; set; }
public virtual ICollection<SalesDetail> SalesDetails { get; set; }
}
public class SalesDetail
{
[Key]
public int SaleDetailsId { get; set; }
public Product Product { get; set; }
public int Quantity { get; set; }
public decimal UnitPrice { get; set; }
public decimal TotalPrice { get; set; }
public virtual Sale Sales { get; set; }
}
public class Product
{
[Key]
public int ProductId { get; set; }
public string BarCode { get; set; }
public string ProductName { get; set; }
public decimal? Price { get; set; }
public int Quantity { get; set; }
public DateTime? DateAdded { get; set; }
public int CategoryId { get; set; }
}
I using Entity Framework How get the data from 3 entities using include I want to get total from Sale and quantity from SaleDetail and Product Name from Product (with SaleID).