Skip to content
This repository was archived by the owner on Dec 10, 2025. It is now read-only.

xrando/CBMS_Backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 

Repository files navigation

COVID Beds Management System - Backend API

A .NET 9.0 Web API backend service for managing hospital beds during COVID-19.

Features

  • Hospital management
  • Bed availability tracking
  • User management (Admin/Citizen)
  • Automated database migrations
  • Password hashing
  • CORS enabled
  • Swagger documentation

Technologies

  • ASP.NET Core 9.0
  • Entity Framework Core
  • SQL Server
  • AutoMapper
  • Swagger/OpenAPI

Project Structure

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

Getting Started

  1. Clone the repository
  2. Update connection string in appsettings.json
  3. Run the following commands:
dotnet restore
dotnet ef database update
dotnet run

Troubleshooting

If you encounter issues with database migrations:

  1. Delete all files in the Migrations folder
  2. Open terminal in the project root and run:
dotnet ef migrations remove
dotnet ef migrations add InitialCreate
dotnet ef database update
  1. Run the application:
dotnet run

API Endpoints

Beds

  • 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

Hospitals

  • 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

Users

  • 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

Database Schema

  • Users (Admin/Citizen inheritance)
  • Hospitals
  • Beds (with Hospital and User relations)

Security

  • Password hashing using ASP.NET Core Identity
  • CORS policy configuration
  • Input validation

Development

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.

Documentation

API documentation is available via Swagger UI when running in Development mode at /swagger.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

  1. Fork the project
  2. Create your 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

About

Covid Beds Management System Backend

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages