public async Task <HotelDto> GetHotel(int id) { var hotel = await _context.Hotels.Where(x => x.Id == id) .Include(x => x.Rooms) .ThenInclude(x => x.Room) .ThenInclude(x => x.Amenities) .ThenInclude(x => x.Amenity) .FirstOrDefaultAsync(); HotelDto dto = new HotelDto() { Id = hotel.Id, Name = hotel.Name, StreetAddress = hotel.StreetAddress, City = hotel.City, State = hotel.State, Phone = hotel.Phone, Rooms = await _hotelRooms.GetHotelRooms(hotel.Id) }; return(dto); }
public async Task <ActionResult <IEnumerable <HotelRoomDto> > > GetHotelRooms(int hotelId) { return(await _hotelRoom.GetHotelRooms(hotelId)); }