using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ПодготовкаКДемо1 { public partial class Hotel { public string CountryName { get; set; } public string CountTour { get; set; } public static List GetHotels() { List hotels = BaseConnect.BaseModel.Hotel.ToList(); foreach(Hotel hotel in hotels) { Country country = BaseConnect.BaseModel.Country.FirstOrDefault(x => x.Code == hotel.CountryCode); if (country != null) hotel.CountryName = country.Name; hotel.CountTour= hotel.Tour.Count().ToString(); } return hotels; } } }