https://github.com/bartugkaan/hotelproject
A comprehensive hotel management system built with ASP.NET Core 8.0, featuring a modern web interface and robust REST API for managing hotel operations including bookings, staff, services, and customer communications.
https://github.com/bartugkaan/hotelproject
asp-net-core automapper efcore fluentvalidation mvc n-tier-architecture rest-api sql
Last synced: 9 months ago
JSON representation
A comprehensive hotel management system built with ASP.NET Core 8.0, featuring a modern web interface and robust REST API for managing hotel operations including bookings, staff, services, and customer communications.
- Host: GitHub
- URL: https://github.com/bartugkaan/hotelproject
- Owner: BartugKaan
- License: mit
- Created: 2025-09-12T08:45:43.000Z (10 months ago)
- Default Branch: master
- Last Pushed: 2025-09-30T16:43:18.000Z (9 months ago)
- Last Synced: 2025-09-30T18:29:07.242Z (9 months ago)
- Topics: asp-net-core, automapper, efcore, fluentvalidation, mvc, n-tier-architecture, rest-api, sql
- Language: C#
- Homepage:
- Size: 24.9 MB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# π¨ Hotel Management System
A comprehensive hotel management system built with ASP.NET Core 8.0, featuring a modern web interface and robust REST API for managing hotel operations including bookings, staff, services, and customer communications.





## π Overview
This Hotel Management System provides a complete solution for hotel operations management. It includes both a RESTful API backend and a responsive web frontend, designed with clean architecture principles and modern development practices.
### π― Key Features
- **π Booking Management**: Complete reservation system with approval workflow
- **π₯ Staff Management**: Employee registration and management
- **ποΈ Service Management**: Hotel services catalog and administration
- **π Contact System**: Customer inquiries and message management
- **πββοΈ Guest Management**: Guest registration and profile management
- **π¨ Room Management**: Room inventory and pricing management
- **π§ Email Notifications**: Automated email system for booking status updates
- **π Authentication & Authorization**: Secure login system with role-based access
- **π± Responsive Design**: Mobile-friendly interface with Bootstrap
- **β
Data Validation**: Comprehensive validation using FluentValidation
## π¨ Project Screenshots

## ποΈ Architecture
The project follows Clean Architecture principles with clear separation of concerns:
```
HotelProject/
βββ ApiConsume/ # Backend API Layer
β βββ HotelProject.Api/ # REST API Controllers
β βββ HotelProject.BusinessLayer/ # Business Logic & Services
β βββ HotelProject.DataAccessLayer/ # Data Access & Repository Pattern
β βββ HotelProject.DtoLayer/ # Data Transfer Objects
β βββ HotelProject.EntityLayer/ # Domain Entities
βββ Frontend/
βββ HotelProject.WebUI/ # MVC Web Application
```
## π οΈ Technologies Used
### Backend
- **ASP.NET Core 8.0** - Web API framework
- **Entity Framework Core 8.0** - Object-Relational Mapping
- **SQL Server** - Database management system
- **AutoMapper 12.0** - Object-to-object mapping
- **FluentValidation 11.5** - Input validation
- **ASP.NET Core Identity 8.0** - Authentication & authorization
- **Swagger/OpenAPI** - API documentation
### Frontend
- **ASP.NET Core MVC 8.0** - Web framework
- **Bootstrap 4** - CSS framework
- **jQuery** - JavaScript library
- **Font Awesome** - Icon library
- **AdminLTE** - Admin dashboard template
### Development Tools
- **Repository Pattern** - Data access abstraction
- **Dependency Injection** - IoC container
- **SOLID Principles** - Clean code practices
- **RESTful API Design** - Standard HTTP methods
## π Prerequisites
Before running this application, make sure you have the following installed:
- [.NET 8.0 SDK](https://dotnet.microsoft.com/download/dotnet/8.0)
- [SQL Server](https://www.microsoft.com/en-us/sql-server/sql-server-downloads) (LocalDB or full installation)
- [Visual Studio 2022](https://visualstudio.microsoft.com/) or [VS Code](https://code.visualstudio.com/)
- [SQL Server Management Studio](https://docs.microsoft.com/en-us/sql/ssms/) (optional, for database management)
## π Getting Started
### 1. Clone the Repository
```bash
git clone https://github.com/your-username/hotel-management-system.git
cd hotel-management-system
```
### 2. Database Setup
1. Update the connection string in both projects:
- `ApiConsume/HotelProject.Api/appsettings.json`
- `Frontend/HotelProject.WebUI/appsettings.json`
```json
{
"ConnectionStrings": {
"DefaultConnection": "Server=(localdb)\\MSSQLLocalDB;Database=HotelProjectDb;Trusted_Connection=true;TrustServerCertificate=true;"
}
}
```
2. Apply database migrations:
```bash
# Navigate to the API project
cd ApiConsume/HotelProject.Api
# Create and apply migrations
dotnet ef database update
```
### 3. Run the Applications
#### Option 1: Using Visual Studio
1. Set both `HotelProject.Api` and `HotelProject.WebUI` as startup projects
2. Press `F5` to run both applications simultaneously
#### Option 2: Using Command Line
Terminal 1 (API):
```bash
cd ApiConsume/HotelProject.Api
dotnet run
```
Terminal 2 (Web UI):
```bash
cd Frontend/HotelProject.WebUI
dotnet run
```
### 4. Access the Applications
- **API Documentation**: `https://localhost:7242/swagger`
- **Web Application**: `https://localhost:7041`
- **Admin Panel**: `https://localhost:7041/AdminLayout`
### 5. Default Login Credentials
The system creates a default admin user on first run:
- **Email**: `admin@hotel.com`
- **Password**: `Admin123!`
## π API Documentation
### Base URLs
- **API**: `https://localhost:7242/api`
- **Web UI**: `https://localhost:7041`
### Core Endpoints
#### π¨ Booking Management
```http
GET /api/Booking # Get all bookings
GET /api/Booking/{id} # Get booking by ID
POST /api/Booking # Create new booking
PUT /api/Booking # Update booking
DELETE /api/Booking/{id} # Delete booking
PUT /api/Booking/ApproveBooking # Approve booking
PUT /api/Booking/RejectBooking # Reject booking
PUT /api/Booking/AddToWaitList # Add to wait list
GET /api/Booking/GetByStatus/{status} # Get bookings by status
```
#### π Room Management
```http
GET /api/Room # Get all rooms
GET /api/Room/{id} # Get room by ID
POST /api/Room # Create new room
PUT /api/Room # Update room
DELETE /api/Room/{id} # Delete room
```
#### π₯ Staff Management
```http
GET /api/Staff # Get all staff
GET /api/Staff/{id} # Get staff by ID
POST /api/Staff # Create new staff
PUT /api/Staff # Update staff
DELETE /api/Staff/{id} # Delete staff
```
#### ποΈ Service Management
```http
GET /api/Service # Get all services
GET /api/Service/{id} # Get service by ID
POST /api/Service # Create new service
PUT /api/Service # Update service
DELETE /api/Service/{id} # Delete service
```
### Request/Response Examples
#### Create Booking Request
```json
POST /api/Booking
{
"name": "John Doe",
"email": "john.doe@email.com",
"checkIn": "2024-10-15T14:00:00",
"checkOut": "2024-10-20T12:00:00",
"adultCount": "2",
"childrenCount": "1",
"roomCount": "1",
"specialRequest": "Late checkout if possible",
"description": "Honeymoon suite preferred"
}
```
#### Booking Response
```json
{
"bookingId": 1,
"name": "John Doe",
"email": "john.doe@email.com",
"checkIn": "2024-10-15T14:00:00",
"checkOut": "2024-10-20T12:00:00",
"adultCount": "2",
"childrenCount": "1",
"roomCount": "1",
"specialRequest": "Late checkout if possible",
"description": "Honeymoon suite preferred",
"status": "Pending"
}
```
## π¨ Web Interface Features
### Public Pages
- **Homepage**: Hotel overview and featured services
- **Booking Form**: Online reservation system
- **Contact Page**: Customer inquiries
- **Services**: Hotel amenities and services
### Admin Dashboard
- **Booking Management**: View, approve, reject, and manage reservations
- **Staff Administration**: Employee management
- **Room Management**: Room inventory control
- **Service Management**: Hotel services administration
- **Contact Management**: Customer inquiry handling
- **Guest Management**: Guest profile administration
## π§ Configuration
### Email Settings
Configure SMTP settings in `appsettings.json`:
```json
{
"EmailSettings": {
"SmtpServer": "smtp.gmail.com",
"SmtpPort": 587,
"SmtpUsername": "your-email@gmail.com",
"SmtpPassword": "your-app-password",
"FromEmail": "your-email@gmail.com",
"FromName": "Hotel Management System"
}
}
```
### Security Settings
- **CSRF Protection**: Enabled with X-CSRF-TOKEN header
- **HTTPS Redirection**: Enforced in production
- **Secure Cookies**: HttpOnly and SameSite policies
- **HSTS**: HTTP Strict Transport Security enabled
## π§ͺ Testing
Run the test suite:
```bash
# Run all tests
dotnet test
# Run tests with coverage
dotnet test --collect:"XPlat Code Coverage"
```
## π¦ Deployment
### IIS Deployment
1. Publish the applications:
```bash
dotnet publish -c Release -o ./publish
```
2. Configure IIS with the published files
3. Update connection strings for production database
4. Configure SSL certificates
### Docker Deployment
```dockerfile
# Dockerfile example
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /src
COPY ["HotelProject.Api/HotelProject.Api.csproj", "HotelProject.Api/"]
RUN dotnet restore "HotelProject.Api/HotelProject.Api.csproj"
COPY . .
WORKDIR "/src/HotelProject.Api"
RUN dotnet build "HotelProject.Api.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "HotelProject.Api.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "HotelProject.Api.dll"]
```
## π€ Contributing
1. Fork the repository
2. Create a feature branch (`git checkout -b feature/AmazingFeature`)
3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request
## π License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
---