# sepcuong/btl_quanlykhachsan architecture

> Architecture diagram of the GitHub repository sepcuong/btl_quanlykhachsan, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sepcuong/btl_quanlykhachsan
- Repository: https://github.com/sepcuong/btl_quanlykhachsan

## Overview

This repository implements hotel-management APIs for room inventory and pricing, customer and user administration, bookings, service usage, and invoices. The principal workflow is an API request routed to a controller, handled through business and repository layers, and persisted through stored procedures; booking operations include search, cancellation, check-in, and check-out. Two API projects expose overlapping controller sets. The graph reflects documented and indexed dependencies; many implementation files were not excerpted, so uncertain runtime links are omitted.

Main entry points: [`DAL/Helper/DatabaseHelper.cs`](https://github.com/sepcuong/btl_quanlykhachsan/blob/master/DAL/Helper/DatabaseHelper.cs) (SQL connection helper), [`BLL`](https://github.com/sepcuong/btl_quanlykhachsan/tree/master/BLL) (Other business services), [`BLL/UserBusiness.cs`](https://github.com/sepcuong/btl_quanlykhachsan/blob/master/BLL/UserBusiness.cs) (User business), [`BLL/DatPhongBusiness.cs`](https://github.com/sepcuong/btl_quanlykhachsan/blob/master/BLL/DatPhongBusiness.cs) (Booking business)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API layer"]
  node_user_api["User API<br/>[UsersController.cs]"]
  node_booking_api["Booking API"]
  node_room_api["Room API<br/>[PhongController.cs]"]
  node_price_api["Room pricing API"]
  node_catalog_api["Hotel management APIs"]
end

subgraph group_business["Business logic"]
  node_user_business["User business<br/>[UserBusiness.cs]"]
  node_booking_business["Booking business"]
  node_business_services["Other business services"]
end

subgraph group_data["Persistence"]
  node_user_repository["User repository<br/>[UserRepository.cs]"]
  node_booking_repository["Booking repository"]
  node_room_repository["Room repository<br/>[PhongRepository.cs]"]
  node_price_repository["Pricing repository"]
  node_other_repositories["Other repositories"]
  node_db_helper["SQL connection helper<br/>[DatabaseHelper.cs]"]
end

subgraph group_domain["Domain models"]
  node_booking_model["Booking record<br/>[DatPhong.cs]"]
  node_user_model["User record<br/>[User.cs]"]
  node_room_model["Room record<br/>[Phong.cs]"]
  node_price_model["Room price record<br/>[GiaPhong.cs]"]
  node_hotel_models["Hotel domain records"]
end

node_client(("API client"))
node_sql_database[("SQL database")]

node_client -->|"requests"| node_user_api
node_client -->|"requests"| node_booking_api
node_client -->|"requests"| node_room_api
node_client -->|"requests"| node_price_api
node_user_api -->|"delegates"| node_user_business
node_booking_api -->|"delegates"| node_booking_business
node_room_api -->|"delegates"| node_business_services
node_price_api -->|"delegates"| node_business_services
node_catalog_api -.->|"delegates"| node_business_services
node_user_business -->|"delegates"| node_user_repository
node_booking_business -->|"delegates"| node_booking_repository
node_business_services -.->|"delegates"| node_other_repositories
node_booking_repository -->|"opens connection"| node_db_helper
node_room_repository -->|"opens connection"| node_db_helper
node_price_repository -->|"opens connection"| node_db_helper
node_other_repositories -.->|"uses connection"| node_db_helper
node_db_helper -->|"connects"| node_sql_database
node_booking_repository -->|"maps records"| node_booking_model
node_room_repository -->|"maps records"| node_room_model
node_price_repository -->|"maps records"| node_price_model
node_user_repository -->|"maps records"| node_user_model
node_other_repositories -.->|"maps records"| node_hotel_models
node_user_business -->|"hashes credentials"| node_user_model
node_booking_business -->|"handles"| node_booking_model

click node_user_api "https://github.com/sepcuong/btl_quanlykhachsan/blob/master/BTL_QuanLyKhachSan/Controllers/UsersController.cs"
click node_booking_api "https://github.com/sepcuong/btl_quanlykhachsan/blob/master/BTL_QuanLyKhachSan/Controllers/DatPhongController.cs"
click node_room_api "https://github.com/sepcuong/btl_quanlykhachsan/blob/master/BTL_QuanLyKhachSan/Controllers/PhongController.cs"
click node_price_api "https://github.com/sepcuong/btl_quanlykhachsan/blob/master/BTL_QuanLyKhachSan/Controllers/GiaPhongController.cs"
click node_catalog_api "https://github.com/sepcuong/btl_quanlykhachsan/tree/master/BTL_QuanLyKhachSan/Controllers"
click node_user_business "https://github.com/sepcuong/btl_quanlykhachsan/blob/master/BLL/UserBusiness.cs"
click node_booking_business "https://github.com/sepcuong/btl_quanlykhachsan/blob/master/BLL/DatPhongBusiness.cs"
click node_business_services "https://github.com/sepcuong/btl_quanlykhachsan/tree/master/BLL"
click node_user_repository "https://github.com/sepcuong/btl_quanlykhachsan/blob/master/DAL/UserRepository.cs"
click node_booking_repository "https://github.com/sepcuong/btl_quanlykhachsan/blob/master/DAL/DatPhongRepository.cs"
click node_room_repository "https://github.com/sepcuong/btl_quanlykhachsan/blob/master/DAL/PhongRepository.cs"
click node_price_repository "https://github.com/sepcuong/btl_quanlykhachsan/blob/master/DAL/GiaPhongRepository.cs"
click node_other_repositories "https://github.com/sepcuong/btl_quanlykhachsan/tree/master/DAL"
click node_db_helper "https://github.com/sepcuong/btl_quanlykhachsan/blob/master/DAL/Helper/DatabaseHelper.cs"
click node_booking_model "https://github.com/sepcuong/btl_quanlykhachsan/blob/master/Model/DatPhong.cs"
click node_user_model "https://github.com/sepcuong/btl_quanlykhachsan/blob/master/Model/User.cs"
click node_room_model "https://github.com/sepcuong/btl_quanlykhachsan/blob/master/Model/Phong.cs"
click node_price_model "https://github.com/sepcuong/btl_quanlykhachsan/blob/master/Model/GiaPhong.cs"
click node_hotel_models "https://github.com/sepcuong/btl_quanlykhachsan/tree/master/Model"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_user_api,node_booking_api,node_room_api,node_price_api,node_catalog_api,node_client toneBlue
class node_user_business,node_booking_business,node_business_services,node_sql_database toneAmber
class node_user_repository,node_booking_repository,node_room_repository,node_price_repository,node_other_repositories,node_db_helper toneMint
class node_booking_model,node_user_model,node_room_model,node_price_model,node_hotel_models toneRose
```

## Components

### API layer

- [User API](https://github.com/sepcuong/btl_quanlykhachsan/blob/master/BTL_QuanLyKhachSan/Controllers/UsersController.cs): `BTL_QuanLyKhachSan/Controllers/UsersController.cs`
- [Booking API](https://github.com/sepcuong/btl_quanlykhachsan/blob/master/BTL_QuanLyKhachSan/Controllers/DatPhongController.cs): `BTL_QuanLyKhachSan/Controllers/DatPhongController.cs`
- [Room API](https://github.com/sepcuong/btl_quanlykhachsan/blob/master/BTL_QuanLyKhachSan/Controllers/PhongController.cs): `BTL_QuanLyKhachSan/Controllers/PhongController.cs`
- [Room pricing API](https://github.com/sepcuong/btl_quanlykhachsan/blob/master/BTL_QuanLyKhachSan/Controllers/GiaPhongController.cs): `BTL_QuanLyKhachSan/Controllers/GiaPhongController.cs`
- [Hotel management APIs](https://github.com/sepcuong/btl_quanlykhachsan/tree/master/BTL_QuanLyKhachSan/Controllers): `BTL_QuanLyKhachSan/Controllers`

### Business logic

- [User business](https://github.com/sepcuong/btl_quanlykhachsan/blob/master/BLL/UserBusiness.cs): `BLL/UserBusiness.cs`
- [Booking business](https://github.com/sepcuong/btl_quanlykhachsan/blob/master/BLL/DatPhongBusiness.cs): `BLL/DatPhongBusiness.cs`
- [Other business services](https://github.com/sepcuong/btl_quanlykhachsan/tree/master/BLL): `BLL`

### Persistence

- [User repository](https://github.com/sepcuong/btl_quanlykhachsan/blob/master/DAL/UserRepository.cs): `DAL/UserRepository.cs`
- [Booking repository](https://github.com/sepcuong/btl_quanlykhachsan/blob/master/DAL/DatPhongRepository.cs): `DAL/DatPhongRepository.cs`
- [Room repository](https://github.com/sepcuong/btl_quanlykhachsan/blob/master/DAL/PhongRepository.cs): `DAL/PhongRepository.cs`
- [Pricing repository](https://github.com/sepcuong/btl_quanlykhachsan/blob/master/DAL/GiaPhongRepository.cs): `DAL/GiaPhongRepository.cs`
- [Other repositories](https://github.com/sepcuong/btl_quanlykhachsan/tree/master/DAL): `DAL`
- [SQL connection helper](https://github.com/sepcuong/btl_quanlykhachsan/blob/master/DAL/Helper/DatabaseHelper.cs): `DAL/Helper/DatabaseHelper.cs`

### Domain models

- [Booking record](https://github.com/sepcuong/btl_quanlykhachsan/blob/master/Model/DatPhong.cs): `Model/DatPhong.cs`
- [User record](https://github.com/sepcuong/btl_quanlykhachsan/blob/master/Model/User.cs): `Model/User.cs`
- [Room record](https://github.com/sepcuong/btl_quanlykhachsan/blob/master/Model/Phong.cs): `Model/Phong.cs`
- [Room price record](https://github.com/sepcuong/btl_quanlykhachsan/blob/master/Model/GiaPhong.cs): `Model/GiaPhong.cs`
- [Hotel domain records](https://github.com/sepcuong/btl_quanlykhachsan/tree/master/Model): `Model`

### Other components

- **API client**
- **SQL database**

## Connections

- API client → User API: requests (evidence: `BTL_QuanLyKhachSan/Controllers/UsersController.cs`)
- API client → Booking API: requests (evidence: `BTL_QuanLyKhachSan/Controllers/DatPhongController.cs`)
- API client → Room API: requests (evidence: `BTL_QuanLyKhachSan/Controllers/PhongController.cs`)
- API client → Room pricing API: requests (evidence: `BTL_QuanLyKhachSan/Controllers/GiaPhongController.cs`)
- User API → User business: delegates (evidence: `BTL_QuanLyKhachSan/Controllers/UsersController.cs`)
- Booking API → Booking business: delegates (evidence: `BTL_QuanLyKhachSan/Controllers/DatPhongController.cs`)
- Room API → Other business services: delegates (evidence: `BTL_QuanLyKhachSan/Controllers/PhongController.cs`)
- Room pricing API → Other business services: delegates (evidence: `BTL_QuanLyKhachSan/Controllers/GiaPhongController.cs`)
- Hotel management APIs → Other business services: delegates (evidence: `BTL_QuanLyKhachSan/Controllers/DatPhongController.cs`)
- User business → User repository: delegates (evidence: `BLL/UserBusiness.cs`)
- Booking business → Booking repository: delegates (evidence: `BLL/DatPhongBusiness.cs`)
- Other business services → Other repositories: delegates (evidence: `BLL/UserBusiness.cs`)
- Booking repository → SQL connection helper: opens connection (evidence: `DAL/DatPhongRepository.cs`)
- Room repository → SQL connection helper: opens connection (evidence: `DAL/PhongRepository.cs`)
- Pricing repository → SQL connection helper: opens connection (evidence: `DAL/GiaPhongRepository.cs`)
- Other repositories → SQL connection helper: uses connection (evidence: `DAL/Helper/DatabaseHelper.cs`)
- SQL connection helper → SQL database: connects (evidence: `DAL/Helper/DatabaseHelper.cs`)
- Booking repository → Booking record: maps records (evidence: `DAL/DatPhongRepository.cs`)
- Room repository → Room record: maps records (evidence: `DAL/PhongRepository.cs`)
- Pricing repository → Room price record: maps records (evidence: `DAL/GiaPhongRepository.cs`)
- User repository → User record: maps records
- Other repositories → Hotel domain records: maps records (evidence: `DAL/DatPhongRepository.cs`)
- User business → User record: hashes credentials (evidence: `BLL/UserBusiness.cs`)
- Booking business → Booking record: handles (evidence: `BLL/DatPhongBusiness.cs`)
