From 102c01b7460ec207bfdb64e5371128c6f2caeac4 Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Wed, 14 Aug 2024 20:53:38 +0200 Subject: [PATCH] =?UTF-8?q?feat:=20add=20current=20user=E2=80=99s=20userna?= =?UTF-8?q?me=20as=20added=5Fwho=20in=20CreateAsync=20method?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DigitalData.UserManager.Application/Services/UserService.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/DigitalData.UserManager.Application/Services/UserService.cs b/DigitalData.UserManager.Application/Services/UserService.cs index f23dc1d..79d42e5 100644 --- a/DigitalData.UserManager.Application/Services/UserService.cs +++ b/DigitalData.UserManager.Application/Services/UserService.cs @@ -51,6 +51,10 @@ namespace DigitalData.UserManager.Application.Services if (await HasEntity(user.Id)) return Result.Fail().Message(_localizer[Key.UserAlreadyExists]); + //set the user + var current_user = await GetUserAsync(); + user.AddedWho = current_user?.Username ?? "UNAUTHORIZED"; + var createdUser = await _repository.CreateAsync(user); if (createdUser is null) return Result.Fail();