Removed todos and added User endpoint combined with register. Id changed to guid
This commit is contained in:
24
src/Infrastructure/Services/UserService.cs
Normal file
24
src/Infrastructure/Services/UserService.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using Hutopy.Domain.Interfaces;
|
||||
using Hutopy.Infrastructure.Identity;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
|
||||
namespace Hutopy.Infrastructure.Services;
|
||||
|
||||
public class UserService(UserManager<ApplicationUser> userManager, SignInManager<ApplicationUser> signInManager) : IUserService
|
||||
{
|
||||
private readonly UserManager<ApplicationUser> _userManager = userManager;
|
||||
private readonly SignInManager<ApplicationUser> _signInManager = signInManager;
|
||||
|
||||
|
||||
public async Task CreateUserAsync(string email, string userName, string password)
|
||||
{
|
||||
var applicationUser = new ApplicationUser
|
||||
{
|
||||
UserName = userName,
|
||||
Email = email,
|
||||
};
|
||||
|
||||
await _userManager.CreateAsync(applicationUser, password);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user