public static List<IdNamePair> GetModels(string year, string make, string countryCode, string languageCulture)
{
if (listModel == null)
{
listModel = new List<IdNamePair>();
using (Entities dataContext = new Entities(System.Configuration.ConfigurationManager.ConnectionStrings["Entities"].ConnectionString))
{
listModel.AddRange((from veh in dataContext.vwVehicle
join model in dataContext.Models on veh.Model equals model.ModelName && model.LanguageCulture == languageculture
where (string.IsNullOrEmpty(year) || year.IndexOf(veh.Year) >= 0) && (string.IsNullOrEmpty(make) || make.IndexOf(veh.Make) >= 0)
&& countryCode == veh.countrycode
orderby veh.Model
select new IdNamePair() { Id = veh.Model, Name = model.ModelLocalized }).Distinct().ToList());
}
return listModel;
}
I am using list to return model id and model name.List use linq query.
I am joining table model and vwvehicle on veh.Model equals model.ModelName.It works find until that,but when I add model.LanguageCulture equals languageculture.
Model table has LanguageCulture column and I need to compare that is same that parameter languageculture I am passing in the list. I am getting error
As follow
Query body must end with the select clause or group clause error.
Can anyone help me with the Linq.