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}"); }