Introduction

In the first two articles, we built the foundation of the HRM project:

Now, in this third and final article, we'll complete the HRM system by adding role‑based dashboards, reports & analytics, and deployment strategies. These features transform the HRM project from a functional prototype into a production‑ready enterprise solution.

Role-Based Dashboards

Dashboards provide tailored views depending on the user's role (Admin, HR, Manager, Employee).

Dashboard Controller

csharp

public class DashboardController : Controller
{
    private readonly ApplicationDbContext _context;
    private readonly UserManager<IdentityUser> _userManager;

    public DashboardController(ApplicationDbContext context, UserManager<IdentityUser> userManager)
    {
        _context = context;
        _userManager = userManager;
    }

    public async Task<IActionResult> Index()
    {
        var user = await _userManager.GetUserAsync(User);
        if (await _userManager.IsInRoleAsync(user, "Admin"))
            return View("AdminDashboard");
        else if (await _userManager.IsInRoleAsync(user, "HR"))
            return View("HRDashboard");
        else if (await _userManager.IsInRoleAsync(user, "Manager"))
            return View("ManagerDashboard");
        else
            return View("EmployeeDashboard");
    }
}

Views

📸 Screenshot Placeholder: Admin dashboard with quick stats.

Reports & Analytics

Reports provide insights into attendance, payroll, and performance.

Report Model

csharp

public class ReportViewModel
{
    public string EmployeeName { get; set; }
    public int TotalDays { get; set; }
    public int PresentDays { get; set; }
    public int AbsentDays { get; set; }
    public decimal NetSalary { get; set; }
}

Reports Controller

csharp

public class ReportsController : Controller
{
    private readonly ApplicationDbContext _context;
    public ReportsController(ApplicationDbContext context) => _context = context;

    public IActionResult AttendanceReport()
    {
        var report = _context.Employees.Select(e => new ReportViewModel
        {
            EmployeeName = e.FullName,
            TotalDays = _context.Attendance.Count(a => a.EmployeeId == e.Id),
            PresentDays = _context.Attendance.Count(a => a.EmployeeId == e.Id && a.IsPresent),
            AbsentDays = _context.Attendance.Count(a => a.EmployeeId == e.Id && !a.IsPresent)
        }).ToList();

        return View(report);
    }

    public IActionResult PayrollReport()
    {
        var report = _context.Payrolls.Select(p => new ReportViewModel
        {
            EmployeeName = p.Employee.FullName,
            NetSalary = p.NetSalary
        }).ToList();

        return View(report);
    }
}

📸 Screenshot Placeholder: Attendance report table, Payroll report table.

Deployment

Step 1: Publish to IIS

Step 2: Deploy to Azure

Step 3: Monitoring

📸 Screenshot Placeholder: Visual Studio publish dialog.

Summary of Part 3