IEnumerable<JobItems> JobItems = from a in db.JobItems where a.job_num == JobNo orderby a.item select a return JobItems;However, a challenge is created when you wish to create a view of a recordset that pulls columns from different tables to de-normalize the data. At that instance, in order to pass the collection around in code, you cannot use the demo-friendly anonymous types; rather, you have to model-up your own classes to hold the results, so you will be working with a typed data collection.
IEnumerable<JobItemsUI> JobItems = from a in db.JobItems where a.job_num == JobNo orderby a.item select new JobItemsUI(a.qty, a.part_no, a.dwg_no, a.Part.desc,a.price); return JobItems;The class:
public class JobItemsUI /// This is a custom class used to represent a UI displayable JobItem collection { public decimal qty { get; set; } public string part_no { get; set; } public string dwg_no { get; set; } public string desc { get; set; } public decimal price { get; set; } public JobItemsUI(decimal Qty, string PartNo, string DwgNo, string Desc, decimal Price) { qty = Qty; part_no = PartNo; dwg_no = DwgNo; desc = Desc; price = Price; } }>Hi,