Refactor delete methods for consistency and clarity

This commit is contained in:
2025-09-12 12:18:24 +01:00
parent e3165c248b
commit 6c3f1561d9
9 changed files with 18 additions and 18 deletions

View File

@@ -41,12 +41,12 @@ public partial class View
private async Task ConfirmDelete() private async Task ConfirmDelete()
{ {
await DeleteVersionAsync(_deleteId); await DeleteAsync(_deleteId);
await HideDeleteModal(); await HideDeleteModal();
await RefreshItemsAsync(); await RefreshItemsAsync();
} }
private async Task DeleteVersionAsync(int id) private async Task DeleteAsync(int id)
{ {
await using DbContext ctx = await DbContextFactory.CreateDbContextAsync(); await using DbContext ctx = await DbContextFactory.CreateDbContextAsync();
MediaFormat? mediaFormat = await ctx.MediaFormats.FindAsync(id); MediaFormat? mediaFormat = await ctx.MediaFormats.FindAsync(id);

View File

@@ -44,12 +44,12 @@ public partial class View
private async Task ConfirmDelete() private async Task ConfirmDelete()
{ {
await DeleteVersionAsync(_deleteId); await DeleteAsync(_deleteId);
await HideDeleteModal(); await HideDeleteModal();
await RefreshItemsAsync(); await RefreshItemsAsync();
} }
private async Task DeleteVersionAsync(int id) private async Task DeleteAsync(int id)
{ {
await using DbContext ctx = await DbContextFactory.CreateDbContextAsync(); await using DbContext ctx = await DbContextFactory.CreateDbContextAsync();
Media? mediaFormat = await ctx.Medias.FindAsync(id); Media? mediaFormat = await ctx.Medias.FindAsync(id);

View File

@@ -41,12 +41,12 @@ public partial class View
private async Task ConfirmDelete() private async Task ConfirmDelete()
{ {
await DeleteVersionAsync(_deleteId); await DeleteAsync(_deleteId);
await HideDeleteModal(); await HideDeleteModal();
await RefreshItemsAsync(); await RefreshItemsAsync();
} }
private async Task DeleteVersionAsync(int id) private async Task DeleteAsync(int id)
{ {
await using DbContext ctx = await DbContextFactory.CreateDbContextAsync(); await using DbContext ctx = await DbContextFactory.CreateDbContextAsync();
MmcSd? mmcSd = await ctx.MmcSd.FindAsync(id); MmcSd? mmcSd = await ctx.MmcSd.FindAsync(id);

View File

@@ -40,12 +40,12 @@ public partial class View
private async Task ConfirmDelete() private async Task ConfirmDelete()
{ {
await DeleteVersionAsync(_deleteId); await DeleteAsync(_deleteId);
await HideDeleteModal(); await HideDeleteModal();
await RefreshItemsAsync(); await RefreshItemsAsync();
} }
private async Task DeleteVersionAsync(int id) private async Task DeleteAsync(int id)
{ {
await using DbContext ctx = await DbContextFactory.CreateDbContextAsync(); await using DbContext ctx = await DbContextFactory.CreateDbContextAsync();
CommonTypes.Metadata.Pcmcia? pcmcia = await ctx.Pcmcia.FindAsync(id); CommonTypes.Metadata.Pcmcia? pcmcia = await ctx.Pcmcia.FindAsync(id);

View File

@@ -56,12 +56,12 @@ public partial class List
private async Task ConfirmDelete() private async Task ConfirmDelete()
{ {
await DeleteVersionAsync(_deleteId); await DeleteAsync(_deleteId);
await HideDeleteModal(); await HideDeleteModal();
await RefreshItemsAsync(); await RefreshItemsAsync();
} }
private async Task DeleteVersionAsync(int id) private async Task DeleteAsync(int id)
{ {
await using DbContext ctx = await DbContextFactory.CreateDbContextAsync(); await using DbContext ctx = await DbContextFactory.CreateDbContextAsync();
CommonTypes.Metadata.Mmc? mmc = await ctx.Mmc.FindAsync(id); CommonTypes.Metadata.Mmc? mmc = await ctx.Mmc.FindAsync(id);

View File

@@ -41,12 +41,12 @@ public partial class View
private async Task ConfirmDelete() private async Task ConfirmDelete()
{ {
await DeleteVersionAsync(_deleteId); await DeleteAsync(_deleteId);
await HideDeleteModal(); await HideDeleteModal();
await RefreshItemsAsync(); await RefreshItemsAsync();
} }
private async Task DeleteVersionAsync(int id) private async Task DeleteAsync(int id)
{ {
await using DbContext ctx = await DbContextFactory.CreateDbContextAsync(); await using DbContext ctx = await DbContextFactory.CreateDbContextAsync();
ScsiMode? mode = await ctx.ScsiMode.FindAsync(id); ScsiMode? mode = await ctx.ScsiMode.FindAsync(id);

View File

@@ -41,12 +41,12 @@ public partial class View
private async Task ConfirmDelete() private async Task ConfirmDelete()
{ {
await DeleteVersionAsync(_deleteId); await DeleteAsync(_deleteId);
await HideDeleteModal(); await HideDeleteModal();
await RefreshItemsAsync(); await RefreshItemsAsync();
} }
private async Task DeleteVersionAsync(int id) private async Task DeleteAsync(int id)
{ {
await using DbContext ctx = await DbContextFactory.CreateDbContextAsync(); await using DbContext ctx = await DbContextFactory.CreateDbContextAsync();
ScsiPage? page = await ctx.ScsiPage.FindAsync(id); ScsiPage? page = await ctx.ScsiPage.FindAsync(id);

View File

@@ -53,12 +53,12 @@ public partial class View
private async Task ConfirmDelete() private async Task ConfirmDelete()
{ {
await DeleteVersionAsync(_deleteId); await DeleteAsync(_deleteId);
await HideDeleteModal(); await HideDeleteModal();
await RefreshItemsAsync(); await RefreshItemsAsync();
} }
private async Task DeleteVersionAsync(int id) private async Task DeleteAsync(int id)
{ {
await using DbContext ctx = await DbContextFactory.CreateDbContextAsync(); await using DbContext ctx = await DbContextFactory.CreateDbContextAsync();
SupportedDensity? supportedDensity = await ctx.SupportedDensity.FindAsync(id); SupportedDensity? supportedDensity = await ctx.SupportedDensity.FindAsync(id);

View File

@@ -41,12 +41,12 @@ public partial class View
private async Task ConfirmDelete() private async Task ConfirmDelete()
{ {
await DeleteVersionAsync(_deleteId); await DeleteAsync(_deleteId);
await HideDeleteModal(); await HideDeleteModal();
await RefreshItemsAsync(); await RefreshItemsAsync();
} }
private async Task DeleteVersionAsync(int id) private async Task DeleteAsync(int id)
{ {
await using DbContext ctx = await DbContextFactory.CreateDbContextAsync(); await using DbContext ctx = await DbContextFactory.CreateDbContextAsync();
Version? version = await ctx.Versions.FindAsync(id); Version? version = await ctx.Versions.FindAsync(id);