mirror of
https://github.com/aaru-dps/Aaru.Server.git
synced 2025-12-16 19:24:27 +00:00
Refactor delete methods for consistency and clarity
This commit is contained in:
@@ -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);
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
Reference in New Issue
Block a user