From 176573ddd1fee3575a45f5e03eee379f2c8ac155 Mon Sep 17 00:00:00 2001 From: cryptooda Date: Sun, 12 Oct 2025 15:54:31 +0700 Subject: [PATCH] Fix update agentName --- src/Managing.Application/Users/UserService.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Managing.Application/Users/UserService.cs b/src/Managing.Application/Users/UserService.cs index f5e7e90b..4230ad7e 100644 --- a/src/Managing.Application/Users/UserService.cs +++ b/src/Managing.Application/Users/UserService.cs @@ -168,9 +168,9 @@ public class UserService : IUserService if (string.IsNullOrEmpty(agentName)) throw new Exception("Agent name cannot be empty"); - // Check if agent name is already used + // Check if agent name is already used by another user var existingUser = await _userRepository.GetUserByAgentNameAsync(agentName); - if (existingUser != null) + if (existingUser != null && existingUser.Id != user.Id) { throw new Exception($"Agent name already used by {existingUser.Name}"); }