diff --git a/AsbCloudInfrastructure/Repository/UserRepository.cs b/AsbCloudInfrastructure/Repository/UserRepository.cs index d14a4727..8ddbc5f3 100644 --- a/AsbCloudInfrastructure/Repository/UserRepository.cs +++ b/AsbCloudInfrastructure/Repository/UserRepository.cs @@ -101,7 +101,8 @@ namespace AsbCloudInfrastructure.Repository var oldUser = (await GetCacheUserAsync(token)).FirstOrDefault(u => u.Id == dto.Id); if (oldUser is null) - return 0; + throw new ArgumentInvalidException + ($"Invalid id {dto.Id}. You can't edit this user.", nameof(dto)); if (oldUser.Login != dto.Login) await AssertLoginIsBusyAsync(dto.Login, token); @@ -132,7 +133,8 @@ namespace AsbCloudInfrastructure.Repository { var user = (await GetCacheUserAsync(token)).FirstOrDefault(u => u.Id == id); if (user is null) - return 0; + throw new ArgumentInvalidException + ($"Invalid id {id}. You can't edit this user.", nameof(id)); var query = dbContext .Users .Where(u => u.Id == id);