add getting employee by email in data
This commit is contained in:
parent
49eb971b5c
commit
b05f91020b
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user