From 20f4f41c17a83b384116689af0ecb4d8385ae8f0 Mon Sep 17 00:00:00 2001 From: glax Date: Wed, 15 Oct 2025 01:48:08 +0200 Subject: [PATCH] Fix remove manga endpoint --- API/Controllers/MangaController.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/API/Controllers/MangaController.cs b/API/Controllers/MangaController.cs index bd9c174..5e13853 100644 --- a/API/Controllers/MangaController.cs +++ b/API/Controllers/MangaController.cs @@ -108,8 +108,9 @@ public class MangaController(MangaContext context) : Controller [ProducesResponseType(Status500InternalServerError, "text/plain")] public async Task, InternalServerError>> DeleteManga (string MangaId) { - if(await context.Mangas.Where(m => m.Key == MangaId).ExecuteDeleteAsync(HttpContext.RequestAborted) < 1) + if(await context.Mangas.FirstOrDefaultAsync(m => m.Key == MangaId, HttpContext.RequestAborted) is not { } manga) return TypedResults.NotFound(nameof(MangaId)); + context.Remove(manga); if(await context.Sync(HttpContext.RequestAborted, GetType(), System.Reflection.MethodBase.GetCurrentMethod()?.Name) is { success: false } result) return TypedResults.InternalServerError(result.exceptionMessage);