我正在返回从 RESTAURANT、CUISINE、CITY 和 STARRATING 表中提取信息的餐馆列表。我想获取每家餐厅及其相关城市和美食的列表,以及 STARRATING 表中的平均评分。到目前为止,这就是我所拥有的……在此先感谢。
RestaurantsEntities db = new RestaurantsEntities();
public List<RESTAURANT> getRestaurantsWRating(string cuisineName, string cityName, string priceName, string ratingName)
{
var cuisineID = db.CUISINEs.First(s => s.CUISINE_NAME == cuisineName).CUISINE_ID;
List<RESTAURANT> result = (from RESTAURANT in db.RESTAURANTs.Include("CITY").Include("CUISINE").Include("STARRATING")
where RESTAURANT.CUISINE_ID == cuisineID
orderby RESTAURANT.REST_NAME ascending
select RESTAURANT).ToList();
return result;
}