A comprehensive web-based Hospital Management System built with ASP.NET Core MVC, Entity Framework Core, and SQL Server. This system manages three types of users: Patients, Doctors, and Administrators.
- User registration with role-based signup (Patient, Doctor, Admin)
- Secure login/logout functionality
- Role-based access control
- Patients: Complete medical profile management including blood type, allergies, emergency contacts, and medical history
- Doctors: Professional profile with department, experience, and license information
- Administrators: Full system access with user management capabilities
- Patient Dashboard: Personal medical information display
- Doctor Dashboard: Professional profile overview
- Admin Dashboard: Complete user management with statistics and user deletion capabilities
- Update personal information
- Role-specific field management
- Secure data validation
- Framework: ASP.NET Core 9.0 MVC
- Database: SQL Server with Entity Framework Core
- Authentication: ASP.NET Core Identity
- Frontend: Bootstrap 5, HTML5, CSS3, JavaScript
- ORM: Entity Framework Core 9.0
- Email (Primary identifier)
- Password (Hashed)
- Role (Patient, Doctor, Admin)
- Name
- CNP (Personal Identification Number)
- Phone Number
- Blood Type
- Emergency Contact
- Allergies
- Weight
- Height
- Birth Date
- Address
- Department
- Years of Experience
- License Number
- .NET 9.0 SDK
- SQL Server (LocalDB or SQL Server Express)
- Visual Studio 2022 or VS Code
git clone <repository-url>
cd HospitalManagementThe application is configured to use SQL Server with the following connection string:
Server=localhost\SQLExpress;Database=HMS;Trusted_Connection=True;MultipleActiveResultSets=true;TrustServerCertificate=True
dotnet restore# Create migration
dotnet ef migrations add InitialCreate
# Update database
dotnet ef database updatedotnet runThe application will be available at https://localhost:5001 or http://localhost:5000
- Navigate to the application URL
- Click "Register" to create your first user account
- Select your role (Patient, Doctor, or Admin)
- Fill in the required information based on your role
- Complete registration and login
- View personal medical dashboard
- Update medical information (blood type, allergies, emergency contacts, etc.)
- Manage personal profile
- View professional dashboard
- Update professional information (department, experience, license)
- Manage personal profile
- Access admin dashboard with user statistics
- View all users in the system
- Delete patients and doctors (cannot delete other admins)
- Manage system users
- Dynamic form fields based on selected user role
- Client-side validation
- Secure password requirements
- Role-specific data collection
- Role-specific information display
- Clean, professional interface
- Easy navigation between features
- Update personal information
- Role-specific field editing
- Data validation and error handling
HospitalManagement/
βββ Controllers/
β βββ AccountController.cs # Authentication & Registration
β βββ HomeController.cs # Dashboard & Profile Management
βββ Models/
β βββ User.cs # Base user model
β βββ Patient.cs # Patient-specific model
β βββ Doctor.cs # Doctor-specific model
β βββ HospitalDbContext.cs # Database context
β βββ ViewModels/
β βββ LoginViewModel.cs # Login form model
β βββ RegisterViewModel.cs # Registration form model
βββ Views/
β βββ Account/
β β βββ Login.cshtml # Login page
β β βββ Register.cshtml # Registration page
β βββ Home/
β β βββ Dashboard.cshtml # User dashboard
β β βββ AdminDashboard.cshtml # Admin dashboard
β β βββ UpdateProfile.cshtml # Profile update form
β βββ Shared/
β βββ _Layout.cshtml # Main layout template
βββ appsettings.json # Configuration
βββ Program.cs # Application startup
βββ HospitalManagement.csproj # Project file
- Password hashing using ASP.NET Core Identity
- Role-based authorization
- CSRF protection
- SQL injection prevention through Entity Framework
- Secure session management
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is licensed under the MIT License.
For support or questions, please create an issue in the repository.
Note: This is a demonstration project for educational purposes. For production use, additional security measures, testing, and features should be implemented.