public async Task <ActionResult <HotelRoomDTO> > GetHotelRoom(int hotelId, int roomNumber) { var hotelRoom = await _hotelRoom.GetHotelRoom(hotelId, roomNumber); if (hotelRoom == null) { return(NotFound()); } return(hotelRoom); }
public async Task <ActionResult <HotelRoom> > GetHotelRoom(int hotelId, int roomId) { var hotelRoom = await _hotelRoomRepo.GetHotelRoom(hotelId, roomId); if (hotelRoom == null) { return(NotFound()); } return(hotelRoom); }
/// <summary> /// GetHotel - allows us to get details on a single hotel /// </summary> /// <param name="id">the unique identifier of the hotel we want to select</param> /// <returns>details on that hotel</returns> public async Task <HotelDTO> GetHotel(int id) { // look in the db on the hotels table where the id is equal to the one brought in as an argument var hotel = await _context.Hotels.Include(h => h.HotelRooms) .ThenInclude(hr => hr.Room) .ThenInclude(r => r.RoomAmenities) .ThenInclude(ar => ar.Amenity) .FirstOrDefaultAsync(h => h.Id == id); if (hotel == null) { return(null); } else { HotelDTO dto = new HotelDTO { Id = hotel.Id, Name = hotel.Name, StreetAddress = hotel.StreetAddress, City = hotel.City, State = hotel.State, Phone = hotel.Phone, }; List <HotelRoomDTO> hotelRoomList = new List <HotelRoomDTO>(); foreach (var hotelRoom in hotel.HotelRooms) { hotelRoomList.Add(await _hotelRoom.GetHotelRoom(id, hotelRoom.RoomNumber)); } ; dto.Rooms = hotelRoomList; return(dto); } }
public async Task <ActionResult <HotelRoomDTO> > GetHotelRoom(int hotelId, int roomNumber) { return(await _hotelRoom.GetHotelRoom(hotelId, roomNumber)); }
public async Task <ActionResult <HotelRoom> > GetHotelRoom(int roomNumber, int hotelId) { return(await _hotelRoom.GetHotelRoom(roomNumber, hotelId)); }
public async Task <ActionResult <HotelRoom> > GetHotelRoom(int hotelId, int roomId) { HotelRoom hotelRoom = await _hotelRoom.GetHotelRoom(hotelId, roomId); return(hotelRoom); }