public async Task <CreateUserResponse> Register(CreateUser dto) { User user = regiserUserMapper.Convert(dto); await this.createUser.SaveUserAsync(user); await this.unityOfWork.Commit(); return(new CreateUserResponse() { Email = user.Email.Value, Login = user.Login.Value }); }
public async Task <LoginResponse> Login(LoginDto loginDto) { User user = this.userDtoToUserMapper.Convert(loginDto); string token = await this.userAuthentication.Authenticate(user); LoginResponse response = userToLoginResponseMapper.Convert(user); response.Token = token; response.LoginAlias = await nameGenerate.Generate(GenderEnum.Undefined, CountryEnum.Portugal); List <User> users = await this.userRepository.FindAsync(x => x.Login.Value == user.Login.Value); response.Id = users.FirstOrDefault().Id; return(response); }