예제 #1
0
        public async Task <IdentityUserDto> Create(BaseIdentityUserCreateDto input)
        {
            var user = new IdentityUser(
                GuidGenerator.Create(),
                input.UserName,
                input.Email,
                CurrentTenant.Id
                );

            input.MapExtraPropertiesTo(user);

            (await UserManager.CreateAsync(user, input.Password)).CheckErrors();
            await UpdateUserByInput(user, input);

            var dto = ObjectMapper.Map <IdentityUser, IdentityUserDto>(user);

            foreach (var id in input.JobIds)
            {
                await _userJobsRepository.InsertAsync(new UserJob(CurrentTenant.Id, user.Id, id));
            }

            foreach (var id in input.OrganizationIds)
            {
                await _userOrgsRepository.InsertAsync(new UserOrganization(CurrentTenant.Id, user.Id, id));
            }

            await CurrentUnitOfWork.SaveChangesAsync();

            return(dto);
        }
예제 #2
0
 public Task <IdentityUserDto> Create(BaseIdentityUserCreateDto input)
 {
     return(_userAppService.Create(input));
 }