Exemple #1
0
        public async Task <HotelDTO> GetHotel(int id, IHotelRoom hotelRoom, IRoom room, IAmenity amenity)
        {
            HotelDTO hotelDTO = await _context.Hotels
                                .Where(x => x.Id == id)
                                .Select(x => new HotelDTO
            {
                Id            = x.Id,
                Name          = x.Name,
                StreetAddress = x.StreetAddress,
                City          = x.City,
                State         = x.State,
                Phone         = x.Phone
            })
                                .FirstAsync();

            hotelDTO.Rooms = await hotelRoom.GetHotelRoomsForHotel(id, room, amenity);

            return(hotelDTO);
        }
Exemple #2
0
        public async Task <List <HotelDTO> > GetHotels(IHotelRoom hotelRoom, IRoom room, IAmenity amenity)
        {
            List <HotelDTO> hotelDTOs = await _context.Hotels
                                        .Select(x => new HotelDTO
            {
                Id            = x.Id,
                Name          = x.Name,
                StreetAddress = x.StreetAddress,
                City          = x.City,
                State         = x.State,
                Phone         = x.Phone
            })
                                        .ToListAsync();

            foreach (HotelDTO oneHotelDTO in hotelDTOs)
            {
                oneHotelDTO.Rooms = await hotelRoom.GetHotelRoomsForHotel(oneHotelDTO.Id, room, amenity);
            }
            return(hotelDTOs);
        }
Exemple #3
0
 public async Task <ActionResult <IEnumerable <HotelRoomDTO> > > GetRoomsForHotel(int hotelId)
 {
     return(await _hotelRoom.GetHotelRoomsForHotel(hotelId, _room, _amenity));
 }