添加项目文件。
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
using IdentityService.Domain.Entities;
|
||||
using IM.Commons;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
|
||||
namespace IdentityService.Domain
|
||||
{
|
||||
public class IdDomainService
|
||||
{
|
||||
private readonly IIdRepository idRepository;
|
||||
public IdDomainService(IIdRepository idRepository)
|
||||
{
|
||||
this.idRepository = idRepository;
|
||||
}
|
||||
|
||||
public async Task<Result<User?>> CreateUserAsync(string userName, string password, string nickName)
|
||||
{
|
||||
SignInResult checkUsername = await idRepository.CheckUsernameAsync(userName);
|
||||
if (!checkUsername.Succeeded)
|
||||
{
|
||||
return Result<User?>.Fail(ResultCode.USER_ALREADY_EXISTS);
|
||||
}
|
||||
return Result<User?>.Success(new User(userName, nickName));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user