From db502ede3404b1bc81c549ca2d724f79a709461b Mon Sep 17 00:00:00 2001 From: cryptooda Date: Thu, 4 Sep 2025 03:42:21 +0700 Subject: [PATCH] exception if agentName is empty --- src/Managing.Application/Users/UserService.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Managing.Application/Users/UserService.cs b/src/Managing.Application/Users/UserService.cs index 6d838b9b..565deda4 100644 --- a/src/Managing.Application/Users/UserService.cs +++ b/src/Managing.Application/Users/UserService.cs @@ -146,6 +146,9 @@ public class UserService : IUserService public async Task UpdateAgentName(User user, string agentName) { + if (string.IsNullOrEmpty(agentName)) + throw new Exception("Agent name cannot be empty"); + // Check if agent name is already used var existingUser = await _userRepository.GetUserByAgentNameAsync(agentName); if (existingUser != null)