A comprehensive hotel booking web application built with ASP.NET Core MVC and Entity Framework Core, featuring a 2019-era tech stack with modern DevContainer support.
Contoso Hotels is a full-featured hotel management and booking system that allows customers to search for available rooms, make reservations, and manage their bookings. The application includes comprehensive data seeding with 5 years of realistic hotel data.
- Backend: ASP.NET Core 3.1 MVC
- Database: SQL Server with Entity Framework Core 3.1.32
- Frontend: Bootstrap 4, jQuery, HTML5, CSS3
- Development: DevContainer support with Docker
- Database Providers: SQL Server in Docker for development/DevContainers, LocalDB for local Windows development
- Customer: Stores customer information and contact details
- Room: Hotel room details including type, price, and amenities
- Booking: Reservation information linking customers to rooms with dates and pricing
- Room Search: Find available rooms by date range, type, and price
- Room Images: Visual showcase of all room types with high-quality images
- Customer Registration: Create and manage customer profiles
- Booking Management: Complete booking workflow from search to confirmation
- Visual Booking Process: Room images displayed throughout booking journey
- Data Seeding: Pre-populated with 5 years of test data
- 200 customers with realistic profiles
- 200 rooms across 10 floors with various types (Standard, Deluxe, Suite, Penthouse, Family, Business)
- 1000+ bookings spanning past and future dates
- .NET Core 3.1 SDK
- SQL Server or SQL Server LocalDB
- Visual Studio Code (recommended) or Visual Studio
- Clone the repository
- Copy the
.devcontainer/.env.examplefile to.devcontainer/.envand set a secure password - Open in Visual Studio Code
- Install the "Dev Containers" extension
- Press
Ctrl+Shift+Pand select "Dev Containers: Reopen in Container" - Wait for the container to build and initialize
- The application will be ready to run
- Clone the repository
- Open the project in your preferred editor
- Set the SQL_PASSWORD environment variable or modify the script:
$env:SQL_PASSWORD="your_secure_password" .\docker-start.ps1
- Copy
appsettings.Development.json.exampletoappsettings.Development.jsonand update the password - Update the database and run the application:
dotnet ef database update dotnet run
-
Clone the repository:
git clone <repository-url> cd ContosoHotels
-
Restore dependencies:
dotnet restore
-
Update the database:
dotnet ef database update
-
Run the application:
dotnet run --urls http://localhost:5050
-
Open your browser to
http://localhost:5050
The Contoso Hotels project follows best practices for security:
- Sensitive credentials are stored in environment variables, not in code
- Database passwords are not committed to source control
- Connection strings use placeholders replaced at runtime
- HTTPS is enforced for all communications
For detailed security guidelines, see SECURITY.md.
- Customers: Customer information and contact details
- Rooms: Room inventory with types, pricing, and amenities
- Bookings: Reservation data with status tracking
- One Customer can have many Bookings
- One Room can have many Bookings
- Each Booking belongs to one Customer and one Room
- Search by check-in/check-out dates
- Filter by room type (Standard, Deluxe, Suite, Penthouse, Family, Business)
- Filter by maximum price
- Real-time availability checking
- Search: Find available rooms for desired dates
- Select: Choose room from search results
- Details: Enter guest information and special requests
- Confirm: Review and confirm booking
- Confirmation: Receive booking confirmation with details
- Standard: $99/night - Basic amenities
- Deluxe: $149/night - Premium amenities and furnishings
- Suite: $249/night - Separate living area and enhanced services
- Family: $179/night - Extra space and child-friendly features
- Business: $189/night - Work area and business amenities
- Penthouse: $499/night - Ultimate luxury with panoramic views
- Responsive Design: Bootstrap 4 responsive layout
- Modern Styling: Custom CSS with hotel-themed color scheme
- Interactive Elements: jQuery-enhanced user interactions
- Form Validation: Client and server-side validation
- Visual Feedback: Loading states, hover effects, and animations
ContosoHotels/
โโโ Controllers/ # MVC Controllers
โโโ Data/ # DbContext and database configuration
โโโ Migrations/ # Entity Framework migrations
โโโ Models/ # Domain models
โโโ Services/ # Business logic and data seeding
โโโ ViewModels/ # View-specific models
โโโ Views/ # Razor views and templates
โโโ wwwroot/ # Static files (CSS, JS, images)
โโโ .devcontainer/ # DevContainer configuration
- build-contoso-hotels: Build the project
- run-contoso-hotels: Run the application (background)
# Create new migration
dotnet ef migrations add MigrationName
# Update database
dotnet ef database update
# Remove last migration
dotnet ef migrations remove- ASP.NET Core 3.1 MVC application structure
- Entity Framework Core data layer with SQL Server
- Complete domain models (Customer, Room, Booking)
- Data seeding service with 5 years of test data
- Room search functionality with availability checking
- Complete booking workflow
- Responsive UI with Bootstrap 4
- DevContainer configuration for development
- Database migrations and schema
- Custom styling and branding
- User authentication and authorization
- Admin panel for hotel management
- Email notifications for bookings
- Payment integration
- Booking cancellation and modification
- Room photos and gallery
- Reviews and ratings system
- Mobile app development
The system checks room availability by ensuring no overlapping bookings exist for the requested date range. The availability algorithm considers:
- Check-in and check-out dates
- Existing confirmed bookings
- Room status (active/inactive)
- Base prices defined per room type
- Ocean view rooms have a 30% premium
- Higher floors more likely to have ocean views
- Dynamic pricing based on amenities
- Pending: Initial booking state
- Confirmed: Payment processed and booking confirmed
- CheckedIn: Guest has arrived and checked in
- CheckedOut: Guest has completed stay
- Cancelled: Booking was cancelled
This project follows the Contoso Hotels coding standards:
- camelCase for variables and functions
- PascalCase for classes and interfaces
- kebab-case for file names
- Comprehensive error handling
- Unit testing
- Clear documentation
This project is for educational and demonstration purposes.
For questions or support regarding this application, please refer to the project documentation or contact the development team.
Built with โค๏ธ using ASP.NET Core and Entity Framework