diff --git a/src/Vegasco.Server.Api/Cars/DeleteCar.cs b/src/Vegasco.Server.Api/Cars/DeleteCar.cs index a86fb04..a6d0aab 100644 --- a/src/Vegasco.Server.Api/Cars/DeleteCar.cs +++ b/src/Vegasco.Server.Api/Cars/DeleteCar.cs @@ -25,14 +25,17 @@ public static class DeleteCar .Where(x => x.Id == new CarId(id)) .ExecuteDeleteAsync(cancellationToken); + if (rows == 0) + { + return TypedResults.NotFound(); + } + if (rows > 1) { var logger = loggerFactory.CreateLogger(nameof(DeleteCar)); logger.LogWarning("Deleted '{DeletedRowCount}' rows for id '{CarId}'", rows, id); } - return rows > 0 - ? TypedResults.NoContent() - : TypedResults.NotFound(); + return TypedResults.NoContent(); } } \ No newline at end of file diff --git a/src/Vegasco.Server.Api/Consumptions/DeleteConsumptions.cs b/src/Vegasco.Server.Api/Consumptions/DeleteConsumptions.cs index 1cbcb46..774741b 100644 --- a/src/Vegasco.Server.Api/Consumptions/DeleteConsumptions.cs +++ b/src/Vegasco.Server.Api/Consumptions/DeleteConsumptions.cs @@ -25,14 +25,17 @@ public static class DeleteConsumption .Where(x => x.Id == new ConsumptionId(id)) .ExecuteDeleteAsync(cancellationToken); + if (rows == 0) + { + return TypedResults.NotFound(); + } + if (rows > 1) { var logger = loggerFactory.CreateLogger(nameof(DeleteConsumption)); logger.LogWarning("Deleted '{DeletedRowCount}' rows for id '{ConsumptionId}'", rows, id); } - return rows > 0 - ? TypedResults.NoContent() - : TypedResults.NotFound(); + return TypedResults.NoContent(); } } \ No newline at end of file