Exemple #1
0
        /// <summary>
        /// Returns a specified hotel
        /// </summary>
        /// <param name="id">Unique identifier of hotel</param>
        /// <returns>Task of completion</returns>
        public async Task <HotelDTO> GetHotel(int id)
        {
            Hotel hotel = await _context.Hotels.FindAsync(id);

            var hotelRoomDTO = await _hotelRoom.GetAllRoomsAtHotel(id);

            HotelDTO dto = new HotelDTO()
            {
                Id            = hotel.Id,
                Name          = hotel.Name,
                StreetAddress = hotel.StreetAddress,
                City          = hotel.City,
                State         = hotel.State,
                Phone         = hotel.Phone,
                HotelRoom     = hotelRoomDTO
            };

            return(dto);
        }