Introduction
Timesheets are essential for tracking employee work hours, project allocation, and payroll. Yet, many organizations still rely on manual spreadsheets, which are error-prone and inefficient. In this article, weβll build a Web-Based Timesheet Management System using ASP.NET Core MVC and SQL Server.
Weβll start with the basics β employee timesheet entry and project allocation β and then move into advanced features like approval workflows, authentication, reporting, and deployment. By the end, youβll have a portfolio-ready application that demonstrates enterprise-grade skills in ASP.NET Core.
Step 1: Project Setup
Clone the Repository
git clone https://github.com/brajeshkr18/WebTimeSheetManagement.git
cd WebTimeSheetManagementConfigure SQL Server in appsettings.json
"ConnectionStrings": {
"DefaultConnection": "Server=.;Database=TimeSheetDB;Trusted_Connection=True;"
}Run EF Core Migrations
dotnet ef database updateLaunch the Application
dotnet runStep 2: Architecture Overview
The project follows a layered MVC structure:
| Layer | Purpose | Example |
|---|---|---|
| Controllers | Handle requests | TimesheetController, ProjectController |
| Models | Define entities | Timesheet, Employee, Project |
| Views | UI with Razor Pages | Timesheet/Index.cshtml |
| Data | EF Core DbContext | ApplicationDbContext |
| Services | Business logic | TimesheetService |
Step 3: Timesheet Entry
Employees can log daily/weekly hours against projects.
public class Timesheet
{
public int Id { get; set; }
public int EmployeeId { get; set; }
public int ProjectId { get; set; }
public DateTime Date { get; set; }
public decimal HoursWorked { get; set; }
}Razor views allow employees to add/edit timesheets.
Validation ensures hours are within limits (e.g., max 24 per day).
Step 4: Project Allocation
Managers assign employees to projects.
Project model links employees to tasks.
Controllers handle CRUD for projects.
Views show project details and assigned employees.
Step 5: Approval Workflow
Managers approve or reject submitted timesheets.
public class TimesheetApproval
{
public int Id { get; set; }
public int TimesheetId { get; set; }
public string Status { get; set; } // Pending, Approved, Rejected
public DateTime ActionDate { get; set; }
}Pending timesheets appear in manager dashboards.
Approval updates status and locks entries.
Rejected entries can be resubmitted by employees.
π Step 6: Authentication & Roles
Secure the system with ASP.NET Core Identity.
Roles
Admin β Manage projects, employees, approvals.
Manager β Approve timesheets, assign projects.
Employee β Submit timesheets.
[Authorize(Roles = "Manager")]
public IActionResult ApproveTimesheet(int id)
{
...
}This ensures only authorized users can perform sensitive actions.
π Step 7: Reporting
Generate reports for payroll and productivity.
Reports
Weekly/Monthly Hours Report per employee.
Project Utilization Report for managers.
Example LINQ Query
var weeklyReport = _context.Timesheets
.Where(t => t.Date >= startDate && t.Date <= endDate)
.GroupBy(t => t.EmployeeId)
.Select(g => new
{
EmployeeId = g.Key,
TotalHours = g.Sum(t => t.HoursWorked)
})
.ToList();Export Options
Excel β ClosedXML
PDF β iTextSharp
π Step 8: Deployment
Configure production DB in appsettings.json.
Deploy to Azure App Service or IIS.
Run migrations before launch:
dotnet ef database updateπ― Conclusion
With all steps complete, you now have a full-featured Web-Based Timesheet Management System:
Employee timesheet entry
Project allocation
Approval workflows
Authentication & Role-based security
Reporting & Deployment


Join the conversation! Your thoughts help the community grow.