Exemple #1
0
 public List<RoomDTO> GetRooms(int hotelId)
 {
     string cs = ConfigurationManager.ConnectionStrings["HotelServiceDB"].ConnectionString;
     IRoomRepository repository = new RoomRepository(cs);
     var rooms = repository.GetRooms(hotelId);
     var roomDTO = new List<RoomDTO>();
     foreach (var room in rooms)
     {
         roomDTO.Add(new RoomDTO()
         {
             Id = room.Id,
             ClientId = room.ClientId,
             HotelId = room.HotelId,
             Name = room.Name,
             Approved = room.Approved
         });
     }
     return roomDTO;
 }
Exemple #2
0
 public void InsertRoom(RoomDTO roomDTO)
 {
     var room = new Room
     {
         ClientId = roomDTO.ClientId,
         HotelId = roomDTO.HotelId,
         Name = roomDTO.Name,
         Approved = roomDTO.Approved
     };
     string connectionString = ConfigurationManager.ConnectionStrings["HotelServiceDB"].ConnectionString;
     IRoomRepository repository = new RoomRepository(connectionString);
     repository.Insert(room);
 }