Linq query returning null when trying to pass a column value fetched from list objects . Is it possible to do as done in the code. Expecting answer or some suggestion.
var query = from p in context.ProcessStepTables
where (p.DiagramID == diagramInfo.DiagramID)
orderby p.ProcessNo select new{
DiagramProcessID = p.DiagramProcessID,
ProcessNo = p.ProcessNo,
ProcessID = p.ProcessID,
ProcessName = Process().Find(x =>
p.ProcessID == x.ProcessID).ProcessName.ToString(),
MakerName = Maker().Find(x=>
p.MakerID==x.MakerID).MakerName.ToString(),
Price = p.Price,
Note = p.Note,
Notice = p.Notice
};
private List<MakerTable> Maker()
{
List<MakerTable> pList = new List<MakerTable>();
try
{
IQueryable<MakerTable> maker = (from data in context.MakerTables
select data) as IQueryable<MakerTable>;
foreach (MakerTable val in maker)
{
pList.Add(val);
}
return pList.OrderBy(x => x.MakerName).ToList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
return null;
}
}