Пример #1
0
 public int GetHotelId(string hotelName)
 {
     string connectionString = ConfigurationManager.ConnectionStrings["HotelServiceDB"].ConnectionString;
     IHotelRepository repository = new HotelRepository(connectionString);
     int hotelId = repository.HotelId(hotelName);
     return hotelId;
 }
Пример #2
0
 public List<HotelDTO> GetHotels()
 {
     string cs = ConfigurationManager.ConnectionStrings["HotelServiceDB"].ConnectionString;
     IHotelRepository repository = new HotelRepository(cs);
     var hotels = repository.GetHotels();
     var hotelDTO = new List<HotelDTO>();
     foreach (var hotel in hotels)
     {
         hotelDTO.Add(new HotelDTO()
         {
             Id = hotel.Id,
             Name = hotel.Name
         });
     }
     return hotelDTO;
 }