我已经尝试了很多,但我无法通过互联网找到任何解决方案。我正在尝试获取集合中属性的值。
这是 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();
我收到一个错误,我想显示仅在柏林的商店。