Modify the Data Model and Repository
To add or remove fields from Timesheet or Leave of Absence (LOA) forms:
Step 1: Model Update
Add the new property in the appropriate model class (e.g., Timesheet.cs).
Step 2: Database Update
Run Entity Framework Core migration:
add-migration "Add new field"
update-database
Step 3: Update the Repository Interface & Implementation
If needed, modify the repository interface (e.g., ITimesheetRepository.cs) to support filtering, inserting, or updating based on the new field.Modify the repository class (e.g., TimesheetRepository.cs) to include the new field in queries, inserts, and updates. For example:


Step 4: Update the ViewModel & DTO (if used)
Add the new property in the related ViewModel or DTO used in the Razor Page.
Step 5: Update the Razor Page UI
Add the new field to the form (e.g., AddEdit.cshtml or _addEdit.cshtml):
<div class="col-sm-12 col-md-12">
<div class="mb-3 m-form__group">
<label class="form-label" asp-for="HoursWorked" disabled="@(Model.LockoutEnabled?" disabled":null)"></label> <sup><i class="fa fa-asterisk required"></i></sup>
<div class="input-group">
<span class="input-group-text"><i class="icofont icofont-clock-time"></i></span>
<input asp-for="HoursWorked" type="number" class="form-control" placeholder="0.0" step="0.25" min="0" />
</div>
<span class="text-danger" asp-validation-for="HoursWorked"></span>
</div>
</div>

Step 6: Bind the Field in PageModel
Ensure the property is bound in the PageModel and correctly handled in OnPostAsync or other relevant methods.