A .NET 9.0 Web API backend service for managing hospital beds during COVID-19.
- Hospital management
- Bed availability tracking
- User management (Admin/Citizen)
- Automated database migrations
- Password hashing
- CORS enabled
- Swagger documentation
- ASP.NET Core 9.0
- Entity Framework Core
- SQL Server
- AutoMapper
- Swagger/OpenAPI
CBMS_Backend_WebApi/
├── Controllers/ # API endpoints
├── Models/ # Domain models and DTOs
├── Repository/ # Data access layer
├── DAL/ # Database context
├── Migrations/ # EF Core migrations
└── Program.cs # Application entry point
- Clone the repository
- Update connection string in
appsettings.json - Run the following commands:
dotnet restore
dotnet ef database update
dotnet runIf you encounter issues with database migrations:
- Delete all files in the
Migrationsfolder - Open terminal in the project root and run:
dotnet ef migrations remove
dotnet ef migrations add InitialCreate
dotnet ef database update- Run the application:
dotnet run- GET
/api/Bed- Get all beds - GET
/api/Bed/{id}- Get bed by ID - GET
/api/Bed/Hospital/{hospitalId}- Get beds by hospital - POST
/api/Bed- Create new bed - PUT
/api/Bed- Update bed - DELETE
/api/Bed/{id}- Delete bed
- GET
/api/Hospital- Get all hospitals - GET
/api/Hospital/{id}- Get hospital by ID - POST
/api/Hospital- Create new hospital - PUT
/api/Hospital- Update hospital - DELETE
/api/Hospital/{id}- Delete hospital
- GET
/api/User- Get all users - GET
/api/User/{id}- Get user by ID - GET
/api/User/Email/{email}- Get user by email - POST
/api/User- Create new user - PUT
/api/User- Update user - DELETE
/api/User/{id}- Delete user
- Users (Admin/Citizen inheritance)
- Hospitals
- Beds (with Hospital and User relations)
- Password hashing using ASP.NET Core Identity
- CORS policy configuration
- Input validation
The project uses Entity Framework Code-First approach with automated migrations. New models should be added to the Models folder and registered in DAL/AppDbContext.cs.
API documentation is available via Swagger UI when running in Development mode at /swagger.
This project is licensed under the MIT License - see the LICENSE file for details.
- Fork the project
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request