I'm trying to retrieve company with trades. I have included the entites and the retrieve method. As shown, the companies are inside trades already.
//company entity
public class Companies
{
public int id { get; set; }
public string companyID { get; set; }
public string companyName { get; set; }
public bool companyMointor { get; set; }
}
//trade entity
public class Trade
{
public int id { get; set; }
public DateTime tradeDate { get; set; }
public double tradePrice { get; set; }
public int tradeQuantity { get; set; }
public Companies tradeCompany { get; set; }
public int type { get; set; }
public types tradeType
{
get { return (Entities.types)type; }
set { type = (int) value; }
}
}
//methods to retrieve
public List<Trade> getTrade()
{
List<Trade> trades = (from t in dbContext.trades
orderby t.tradeDate descending
select t).ToList();
return trades;
}