Skip to content

waqas1412/EmployeeManagement

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

8 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ‘₯ Employee Management System

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.

.NET Core ASP.NET Core Entity Framework SQL Server License

✨ Features

πŸ” Authentication & Authorization

  • 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

πŸ‘€ Employee Management

  • 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

🎨 User Interface

  • 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

πŸ›  Technical Features

  • 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

πŸš€ Quick Start

Prerequisites

Installation

  1. Clone the repository

    git clone https://github.com/yourusername/EmployeeManagement.git
    cd EmployeeManagement
  2. Restore dependencies

    dotnet restore
  3. Update database connection string

    // appsettings.json
    {
      "ConnectionStrings": {
        "EmployeeDBConnection": "server=(localdb)\\MSSQLLocalDB;database=EmployeeDB;Trusted_Connection=True"
      }
    }
  4. Run database migrations

    dotnet ef database update
  5. Launch the application

    dotnet run
  6. Access the application

    • Navigate to https://localhost:5001 or http://localhost:5000
    • Register a new user account
    • Start managing employees!

πŸ“ Project Structure

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

πŸ”§ Configuration

Database Configuration

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"
  }
}

Logging Configuration

NLog is configured in nlog.config for comprehensive application logging.

Email Domain Validation

Custom email domain validation is implemented in ValidEmailDomainAttribute.cs.

πŸ›‘ Security Features

  • 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

πŸ“Š Database Schema

Employees Table

  • Id (Primary Key)
  • Name (Required)
  • Email (Required, Validated)
  • Department (HR, Payroll, IT, None)
  • PhotoPath (Profile picture path)

Users Table (ASP.NET Core Identity)

  • Extended ApplicationUser with additional City field
  • Standard Identity fields (Email, PasswordHash, etc.)

Roles Table

  • Role-based authorization support
  • Custom role creation and management

🎯 Usage Examples

Creating a New Employee

  1. Navigate to the employee creation page
  2. Fill in employee details (Name, Email, Department)
  3. Upload a profile picture (optional)
  4. Submit the form

Managing User Roles

  1. Access the Administration section
  2. Create new roles as needed
  3. Assign roles to users for access control

Viewing Employee Details

  1. Browse the employee list
  2. Click on any employee to view detailed information
  3. Edit or delete employee records as needed

🀝 Contributing

We welcome contributions! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Development Guidelines

  • Follow C# coding conventions
  • Add appropriate unit tests for new features
  • Update documentation for any API changes
  • Ensure all tests pass before submitting PR

πŸ“ License

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

πŸ™ Acknowledgments

πŸ“ž Support

If you encounter any issues or have questions:


Made with ❀️ using ASP.NET Core

About

A learning project built with ASP.NET Core.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors