I am trying to select stores using a lambda function and converting the result to a SelectListItem so I can render it. However it is throwing a \"Type of Expression
You appear to be trying to mix query expression syntax and "normal" lambda expression syntax. You can either use:
IEnumerable stores =
from store in database.Stores
where store.CompanyID == curCompany.ID
select new SelectListItem { Value = store.Name, Text = store.ID};
ViewBag.storeSelector = stores;
Or:
IEnumerable stores = database.Stores
.Where(store => store.CompanyID == curCompany.ID)
.Select(s => new SelectListItem { Value = s.Name, Text = s.ID});
ViewBag.storeSelector = stores;
You can't mix the two like you're trying to.