/// <summary> /// 筛选前7个 /// </summary> /// <param name="HotelNum">数量</param> /// <returns></returns> public static List <HotelManag> GetHotelsrecommend(int HotelNum) { int i = 0; List <HotelManag> list = new List <HotelManag>(); var Hotrl = HotelMapper.Getrecommend(); foreach (var item in Hotrl) { if (HotelNum > i) { list.Add(item); i++; continue; } break; } return(list); }