示例#1
0
        public async Task <InsertUserResponseDTO> InsertUserAsync(InsertUserRequestDTO request)
        {
            InsertUserResponseDTO response = new InsertUserResponseDTO();

            var app = await uow.Application.GetAsync(x => x.Id == request.ApplicationId);

            if (app == null)
            {
                throw new BusinessException(ResponseCode.ApplicationNotFound);
            }

            string password       = request.Password;
            var    hashedpassword = HashHelper.GetEncryptedString(password);
            User   createdUser    = new User(request.UserName, request.Name, request.SurName, request.Email, hashedpassword[0], hashedpassword[1]);


            await uow.User.InsertAsync(createdUser);

            await uow.CompleteAsync();

            UserApplication usrApp = new UserApplication(app.Id, createdUser.Id);


            await uow.UserApplication.InsertAsync(usrApp);

            await uow.CompleteAsync();

            return(response);
        }
示例#2
0
 public async Task <InsertUserResponseDTO> InsertUserAsync(InsertUserRequestDTO request)
 {
     return(await AuthenticationService.InsertUserAsync(request));
 }