From b95baaef5fa6c009a6cad70342dc07b44f06a7e8 Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Tue, 20 May 2025 12:38:03 +0200 Subject: [PATCH] Enforce ID retrieval in UpdateAsync method Updated the `UpdateAsync` method in `CRUDService.cs` to replace the use of `GetIdOrDefault()` with `GetId()`. This change ensures that an ID must be present in the `updateDto`, enhancing the reliability of the update process. --- DigitalData.Core.Application/CRUDService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DigitalData.Core.Application/CRUDService.cs b/DigitalData.Core.Application/CRUDService.cs index e235ccd..467d20f 100644 --- a/DigitalData.Core.Application/CRUDService.cs +++ b/DigitalData.Core.Application/CRUDService.cs @@ -47,7 +47,7 @@ namespace DigitalData.Core.Application /// A service message indicating success or failure. public virtual async Task UpdateAsync(TUpdateDto updateDto) { - var currentEntitiy = await _repository.ReadByIdAsync(updateDto.GetIdOrDefault()); + var currentEntitiy = await _repository.ReadByIdAsync(updateDto.GetId()); if (currentEntitiy is null) return Result.Fail().Notice(LogLevel.Warning, Flag.NotFound, $"{updateDto.GetIdOrDefault()} is not found in update process of {GetType()} entity.");