A modern, secure employee management web application built with ASP.NET Core 2.2, featuring user authentication, role-based authorization, and comprehensive employee data management.
- User Registration & Login: Secure user account management with ASP.NET Core Identity
- Role-Based Access Control: Create and manage user roles for different access levels
- Email Validation: Custom email domain validation with regex patterns
- Session Management: Persistent login sessions with remember me functionality
- CRUD Operations: Complete Create, Read, Update, Delete functionality for employees
- Department Management: Organize employees by departments (HR, Payroll, IT)
- Photo Upload: Profile picture management with file upload capabilities
- Data Validation: Comprehensive input validation with custom attributes
- Responsive Design: Bootstrap-based responsive web interface
- Modern UI: Clean, professional design with intuitive navigation
- Photo Display: Employee profile pictures with fallback to default images
- Form Validation: Client-side and server-side validation with user-friendly error messages
- Repository Pattern: Clean separation of concerns with repository abstraction
- Dependency Injection: IoC container for loose coupling
- Database Migrations: Entity Framework migrations for database schema management
- Logging: NLog integration for comprehensive application logging
- Error Handling: Custom error pages and exception handling
- .NET Core 2.2 SDK
- SQL Server LocalDB (included with Visual Studio)
- Visual Studio 2019 or Visual Studio Code
-
Clone the repository
git clone https://github.com/yourusername/EmployeeManagement.git cd EmployeeManagement -
Restore dependencies
dotnet restore
-
Update database connection string
// appsettings.json { "ConnectionStrings": { "EmployeeDBConnection": "server=(localdb)\\MSSQLLocalDB;database=EmployeeDB;Trusted_Connection=True" } }
-
Run database migrations
dotnet ef database update
-
Launch the application
dotnet run
-
Access the application
- Navigate to
https://localhost:5001orhttp://localhost:5000 - Register a new user account
- Start managing employees!
- Navigate to
EmployeeManagement/
βββ Controllers/ # MVC Controllers
β βββ AccountController.cs # User authentication
β βββ AdministrationController.cs # Role management
β βββ EmployeeController.cs # Employee operations
β βββ HomeController.cs # Main application logic
β βββ ErrorController.cs # Error handling
βββ Models/ # Data models and DbContext
β βββ Employee.cs # Employee entity
β βββ ApplicationUser.cs # Extended Identity user
β βββ Dept.cs # Department enumeration
β βββ AppDbContext.cs # Entity Framework context
β βββ Repositories/ # Data access layer
βββ ViewModels/ # View models for data binding
βββ Views/ # Razor views
β βββ Account/ # Authentication views
β βββ Administration/ # Role management views
β βββ Employees/ # Employee management views
β βββ Shared/ # Layout and common views
βββ Migrations/ # Entity Framework migrations
βββ wwwroot/ # Static files (CSS, JS, images)
βββ Utilities/ # Custom utilities and attributes
The application uses SQL Server LocalDB by default. You can modify the connection string in appsettings.json:
{
"ConnectionStrings": {
"EmployeeDBConnection": "server=(localdb)\\MSSQLLocalDB;database=EmployeeDB;Trusted_Connection=True"
}
}NLog is configured in nlog.config for comprehensive application logging.
Custom email domain validation is implemented in ValidEmailDomainAttribute.cs.
- ASP.NET Core Identity: Secure user authentication and authorization
- Password Hashing: Secure password storage with ASP.NET Core Identity
- CSRF Protection: Built-in Cross-Site Request Forgery protection
- Input Validation: Comprehensive server-side and client-side validation
- Role-Based Authorization: Fine-grained access control
Id(Primary Key)Name(Required)Email(Required, Validated)Department(HR, Payroll, IT, None)PhotoPath(Profile picture path)
- Extended
ApplicationUserwith additionalCityfield - Standard Identity fields (Email, PasswordHash, etc.)
- Role-based authorization support
- Custom role creation and management
- Navigate to the employee creation page
- Fill in employee details (Name, Email, Department)
- Upload a profile picture (optional)
- Submit the form
- Access the Administration section
- Create new roles as needed
- Assign roles to users for access control
- Browse the employee list
- Click on any employee to view detailed information
- Edit or delete employee records as needed
We welcome contributions! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Follow C# coding conventions
- Add appropriate unit tests for new features
- Update documentation for any API changes
- Ensure all tests pass before submitting PR
This project is licensed under the MIT License - see the LICENSE file for details.
- ASP.NET Core - Web framework
- Entity Framework Core - ORM framework
- Bootstrap - CSS framework
- NLog - Logging framework
If you encounter any issues or have questions:
- Create an Issue
- Check the Documentation
- Contact the maintainers
Made with β€οΈ using ASP.NET Core