diff --git a/TheCyclopsProject/TheCyclopsBusinessLogic/Implementations/EmployeeBusinessLogicContract.cs b/TheCyclopsProject/TheCyclopsBusinessLogic/Implementations/EmployeeBusinessLogicContract.cs index d6545da..d275d3c 100644 --- a/TheCyclopsProject/TheCyclopsBusinessLogic/Implementations/EmployeeBusinessLogicContract.cs +++ b/TheCyclopsProject/TheCyclopsBusinessLogic/Implementations/EmployeeBusinessLogicContract.cs @@ -1,5 +1,6 @@ using Microsoft.Extensions.Logging; using System.Text.Json; +using System.Text.RegularExpressions; using TheCyclopsContracts.BusinessLogicContracts; using TheCyclopsContracts.DataModels; using TheCyclopsContracts.Exceptions; @@ -64,6 +65,10 @@ internal class EmployeeBusinessLogicContract(IEmployeeStorageContract employeeSt { return _employeeStorageContract.GetElementById(data) ?? throw new ElementNotFoundException(data); } + if (Regex.IsMatch(data, @"^\S+@\S+\.\S+$")) + { + return _employeeStorageContract.GetElementByEmail(data) ?? throw new ElementNotFoundException(data); + } return _employeeStorageContract.GetElementByFIO(data) ?? throw new ElementNotFoundException(data); }