@using PowderCoating.Web.Controllers @model List @{ ViewData["Title"] = "Data Purge & Cleanup"; var groups = Model.GroupBy(s => s.Group).ToList(); var totalSoftDeleted = Model.Sum(s => s.Total); } @section Styles { }

Data Purge & Cleanup

Permanently remove soft-deleted records from the database
@totalSoftDeleted.ToString("N0") soft-deleted records
@* Alert messages *@ @if (TempData["PurgeSuccess"] != null) { } @* Warning banner *@
Destructive operation — this cannot be undone. Purging permanently deletes records from the database. Soft-deleted records are hidden from users but still occupy database space. Use this tool periodically to reclaim space and keep the database clean. Job photo blobs in Azure Storage are also deleted when purging job photo records.
@* Left: Entity stats *@
@foreach (var group in groups) {
@group.Key
@foreach (var s in group) { }
Entity Total 0–30d 30–90d >90d Oldest
@s.Label @if (s.Total > 0) { @s.Total } else { } @if (s.DeletedLast30Days > 0) { @s.DeletedLast30Days } else { } @if (s.Deleted30To90Days > 0) { @s.Deleted30To90Days } else { } @if (s.DeletedOlderThan90Days > 0) { @s.DeletedOlderThan90Days } else { } @(s.OldestDeletion.HasValue ? s.OldestDeletion.Value.ToString("MM/dd/yyyy") : "—")
@group.Key
@foreach (var s in group) {
@s.Label
Oldest: @(s.OldestDeletion.HasValue ? s.OldestDeletion.Value.ToString("MM/dd/yyyy") : "—")
Total deleted @if (s.Total > 0) { @s.Total } else { }
0–30d / 30–90d / >90d @s.DeletedLast30Days / @s.Deleted30To90Days / @s.DeletedOlderThan90Days
}
}
@* Right: Purge controls *@
Purge Options
@* Threshold *@
Only soft-deleted records older than this threshold will be affected.
@* Select All *@
@* Preview *@ @* Preview results *@
Would delete:

@* Execute form *@
@Html.AntiForgeryToken()
Action is logged to Audit Log.
@* Confirm modal *@ @section Scripts { }