私はたくさん試しましたが、インターネット上で解決策を見つけることができません。コレクション内のプロパティの値を取得しようとしています。
これは DeliveryShop エンティティです:
[Key]
public int DeliveryShopId { get; set; }
public int MinOrderForDelivery { get; set; }
public bool HasDelivery { get; set; }
public bool HasTakeAway { get; set; }
public virtual List<Location> Locations { get; set; }
これは場所エンティティです:
[Key]
public int LocationId { get; set; }
public int DeliveryShopId { get; set; }
public string City { get; set; }
public string Country { get; set; }
public string ZIP { get; set; }
public virtual DeliveryShop DeliveryShop { get; set; }
これは、インデックス アクション メソッドのクエリです。
viewModel.DeliveryShop = db.DeliveryShops.Where(c => c.Locations.Where(l => l.City == "Berlin")).ToList();
ベルリンにしかないショップを表示したいのですが、エラーが出ます。