added findByUserNameAsync to the interface and service

This commit is contained in:
Dominic Villemure
2024-06-06 18:04:42 -04:00
parent 0da652b4a4
commit 4a5abf59eb
2 changed files with 19 additions and 0 deletions

View File

@@ -21,6 +21,24 @@ public class IdentityService(
return user?.UserName;
}
public async Task<UserModel?> GetUserByUserNameAsync(string userName)
{
var response = await userManager.FindByNameAsync(userName);
if (response == null) return null;
var userModel = new UserModel()
{
Id = response.Id,
UserName = response.UserName,
FirstName = response.FirstName,
LastName = response.LastName,
Email = response.Email,
};
return userModel;
}
public async Task<(Result Result, string UserId)> CreateUserAsync(string userName, string password)
{