Classroom / Room Management System (CRMS) — Backend API Built with ASP.NET Core + Entity Framework Core + MySQL
CRMS Backend provides the RESTful API layer for managing classroom borrowing operations.
The system enforces domain-level business rules including:
- Borrowing lifecycle management
- Status transition constraints
- Conflict detection
- Soft delete behavior
- Advanced query filtering
- Dashboard aggregation
This backend is designed to align strictly with the CRMS Frontend contract.
- ASP.NET Core
- Entity Framework Core
- MySQL
- Swagger (OpenAPI)
- Dependency Injection
- RESTful API Architecture
- .NET SDK 8.0 (or compatible)
- MySQL Server
- Node.js (if running frontend together)
git clone <repository-url>
cd crms-backendUpdate appsettings.Development.json:
{
"ConnectionStrings": {
"DefaultConnection": "server=localhost;port=3306;database=crms;user=root;password=yourpassword;"
}
}Ensure:
- Database exists
- Credentials are correct
In appsettings.Development.json:
{
"Cors": {
"AllowedOrigins": [
"http://localhost:5173"
]
}
}If frontend runs on different port, update accordingly.
dotnet runDefault API endpoint:
http://localhost:5233
Swagger UI available at:
http://localhost:5233/swagger
- Create borrowing request
- Update borrowing
- Soft delete borrowing
- Get single borrowing
- Paginated borrowing list
Allowed transitions:
| From | Allowed To |
|---|---|
| Requested | Approved, Rejected, Cancelled |
| Approved | Completed, Cancelled |
| Rejected | — |
| Completed | — |
| Cancelled | — |
Invalid transitions return:
400 Bad Request
When status becomes Approved:
- Validates room availability
- Checks overlapping time range
- Returns conflict response if violation occurs
Supports:
-
Multi-status filtering:
?status=Requested&status=Approved -
Multi-field search
-
Date range overlap filtering
-
Sorting
-
Pagination
-
Pagination metadata
Returns aggregated metrics:
totalRooms
totalBorrowings
totalApproved
totalRequested
latestBorrowings[]
Optimized for frontend summary display.
GET /api/borrowing
GET /api/borrowing/{id}
POST /api/borrowing
PUT /api/borrowing/{id}
DELETE /api/borrowing/{id}
GET /api/dashboard
Enums are serialized as strings using:
JsonStringEnumConverterExample:
"status": "Approved"Current Stable Version:
v1.0.0
Semantic Versioning:
- PATCH → Bug fix
- MINOR → Feature addition
- MAJOR → Breaking change
Branching Strategy:
main → Stable release
develop → Active development
feature/* → New features
fix/* → Bug fixes
Tagging is performed on main.
- Soft delete is globally filtered via EF Core.
- Availability validation handled in service layer.
- Status history tracking is preserved on transition.
- Designed to align with CRMS Frontend v1.0.0.