forked from ddrilling/AsbCloudServer
This commit is contained in:
parent
41d9e506bd
commit
f86a9d1bc2
@ -58,5 +58,25 @@
|
||||
/// DTO компании
|
||||
/// </summary>
|
||||
public CompanyDto Company { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Получение отображаемого имени
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string MakeDisplayName()
|
||||
{
|
||||
if (string.IsNullOrEmpty(Surname))
|
||||
return Login;
|
||||
|
||||
var s = Surname;
|
||||
if (!string.IsNullOrEmpty(Name))
|
||||
{
|
||||
s += $"{Name[0]}.";
|
||||
if (!string.IsNullOrEmpty(Patronymic))
|
||||
s += $" {Patronymic[0]}.";
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -183,9 +183,9 @@ namespace AsbCloudInfrastructure.Repository
|
||||
{
|
||||
var existingUserDto = (await GetCacheUserAsync(token))
|
||||
.FirstOrDefault(u => u.Login.ToLower() == login.ToLower());
|
||||
var existingUser = Convert(existingUserDto);
|
||||
if (existingUser is not null)
|
||||
throw new ArgumentInvalidException($"Login {login} is busy by {existingUser.MakeDisplayName()}, id{existingUser.Id}", nameof(login));
|
||||
|
||||
if (existingUserDto is not null)
|
||||
throw new ArgumentInvalidException($"Login {login} is busy by {existingUserDto.MakeDisplayName()}, id{existingUserDto.Id}", nameof(login));
|
||||
}
|
||||
|
||||
private Task<IEnumerable<UserExtendedDto>> GetCacheUserAsync(CancellationToken token)
|
||||
|
Loading…
Reference in New Issue
Block a user