feat: add current user’s username as added_who in CreateAsync method
This commit is contained in:
parent
1375015275
commit
102c01b746
@ -51,6 +51,10 @@ namespace DigitalData.UserManager.Application.Services
|
|||||||
if (await HasEntity(user.Id))
|
if (await HasEntity(user.Id))
|
||||||
return Result.Fail<int>().Message(_localizer[Key.UserAlreadyExists]);
|
return Result.Fail<int>().Message(_localizer[Key.UserAlreadyExists]);
|
||||||
|
|
||||||
|
//set the user
|
||||||
|
var current_user = await GetUserAsync();
|
||||||
|
user.AddedWho = current_user?.Username ?? "UNAUTHORIZED";
|
||||||
|
|
||||||
var createdUser = await _repository.CreateAsync(user);
|
var createdUser = await _repository.CreateAsync(user);
|
||||||
if (createdUser is null)
|
if (createdUser is null)
|
||||||
return Result.Fail<int>();
|
return Result.Fail<int>();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user