I have a table of Scos that has the fields Id and Title - e.g. 1 Algebra, 2 History, 3 French, 4 Math etc. I would like to create a dropdown list in MVC of these Scos that are not already referred to by in the table CourseScos which includes the ScoId as the foreign key. For example, in the table CourseScos with fields Id and ScoId that has records 1 1, 2 2 - I would hope to generate a dropdown list that shows French and Math.
What I have so far is as follows:
var exceptionList = db.CourseScos.Where(s=>s.ScoId>0).Select(s => s.ScoId); //Scos already used by course
var query = db.Scos
.Select(e => e.Id)
ViewBag.ScoId = new SelectList(query, "Id", "Title");
While the list query shows the proper records, it does not include the fields Id and Title that I need to include in the dropdown list. Any help figuring out how to do this greatly appreciated.