У меня есть следующий DTO:
public class ContinentScopeDto
{
public string Name { get; set; }
public long? ContinentId { get; set; }
public List<CountryScopeDto> CountriessPairList { get; set; }
}
Модель CountryScopeDto выглядит следующим образом:
public class CountryScopeDto
{
public string CountryName { get; set; }
public long? CountryId { get; set; }
}
Я хочу иметь возможность выбрать название и идентификатор континента и список связанных стран.
Мой запрос linq выглядит следующим образом:
var query = (from branch in this.DataAccess.GetOperations<PA_BRANCHES>().FindAll(item => silosBranch.Contains(item.Id))
join country in this.DataAccess.GetOperations<PA_LIST_OF_COUNTRIES>().FindAll()
on branch.COU_N_ID equals country.Id
join countryTrad in this.DataAccess.GetOperations<PA_LIST_OF_COUNTRIES_TRAD>().FindAll(item => item.LANG_CH_TAG.Equals(userlang))
on country.Id equals countryTrad.COU_N_ID
join continentTrad in this.DataAccess.GetOperations<PA_LIST_OF_CONTINENTS_TRAD>().FindAll(item => item.LANG_CH_TAG.Equals(userlang))
on country.CONT_N_ID equals continentTrad.CONT_N_ID
select new ContinentScopeDto
{
Name = continentTrad.TONT_CH_LABEL,
ContinentId = continentTrad.CONT_N_ID,
CountriessPairList = new List<CountryScopeDto>
{
}
}
);
Здесь я не знаю, как составить список стран этого континента.
Мой запрос должен вернуть список континентов с указанием их стран.
Любая помощь, пожалуйста.