A partially implemented hotel booking system. Your task is to complete the missing pieces in both the backend and frontend.
cd backend
dotnet run --project src/BookingApi- API runs at http://localhost:5000
- Swagger UI at http://localhost:5000/swagger
cd frontend
npm install
npm run dev- Frontend runs at http://localhost:5173
In Controllers/RoomsController.cs:
- ❌
GET /api/rooms- TODO (add optionalisAvailablefiltering) - ✅
GET /api/rooms/{id}- Done - ❌
GET /api/rooms/{id}/availability- TODO
In Controllers/BookingsController.cs:
- ❌
POST /api/bookings- TODO
- ❌
components/RoomList.tsx- Implement loading, error, empty, and list states - ❌
components/BookingForm.tsx- Implement the submit handler - ❌
App.tsx- Implement handleBookingSuccess
~60-90 minutes for both backend and frontend.
- In-memory repository with sample room and booking data
- Models and DTOs
- Repository interface and implementation
- Two working endpoints as reference
- API client functions in
src/api/client.ts - TypeScript types in
src/types/index.ts - Custom hooks for data fetching
- UI components (RoomCard, DateRangePicker)
- TailwindCSS styling
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/rooms | Get all rooms |
| GET | /api/rooms?isAvailable=true&checkIn=...&checkOut=... | Get available rooms for date range |
| GET | /api/rooms/{id} | Get room by ID |
| GET | /api/rooms/{id}/availability?checkIn=...&checkOut=... | Check room availability |
| POST | /api/bookings | Create a booking |