Hello,
I have this OrderDetail class. I want to set the Currency field to ExtendedCurrency. Can I set it in the LINQ query below? Or is it possible to set it in the class?
Thank you.
I have this OrderDetail class. I want to set the Currency field to ExtendedCurrency. Can I set it in the LINQ query below? Or is it possible to set it in the class?
Thank you.
C#:
public async Task<IEnumerable<Order?>> GetAllOrders()
{
return await _db.Orders.Include(d => d.OrderDetails).ThenInclude(v => v.Vendor).ToListAsync();
}
C#:
public class OrderDetail
{
public int Id { get; set; }
[Required]
[MaxLength(100)]
public string ProductCode { get; set; }
[Required]
[MaxLength(250)]
public string ProductName { get; set; }
[Required]
public int BuyQuantity { get; set; }
[Required]
public int SellQuantity { get; set; }
public double CostRatio { get; set; }
public double UnitCost { get; set; }
public double TotalBuyPrice { get; set; }
public double TotalSellPrice { get; set; }
[MaxLength(150)]
public string ShippingNumber { get; set; }
public string Status { get; set; }
[MaxLength(150)]
public string TrackingNumber { get; set; }
[MaxLength(400)]
public string Description { get; set; }
public string Currency { get; set; }
public int OrderId { get; set; }
public int VendorId { get; set; }
public Order Order { get; set; }
public Vendor Vendor { get; set; }
[NotMapped] public string? ExtendedCurrency { get; set; }
}