Exemplo n.º 1
0
        // make assumption here that user can request a specific room number
        public async Task <IRoom> BookRoomByNumberAsync(IReservation reservation, int roomNum)
        {
            var room = await _hotelRepository.GetRoomByNumber(roomNum);

            if (!room.IsRoomAvailableForBooking(reservation))
            {
                throw new Exception($"Room {roomNum} is not available for booking");
            }

            await _hotelRepository.AddBookedRoom(reservation, roomNum);

            return(room);
        }