public async Task <AppUserDTO> CreateAsync(CreateAppUserDTO dto) { var item = _mapper.Map <AppUser>(dto); item.Salt = SecurityHelper.GetNewSalt(); item.Password = SecurityHelper.EncryptPassword(dto.Password, item.Salt); var createdUser = await _repository.CreateItemAsync(item); return(_mapper.Map <AppUserDTO>(createdUser)); }
public async Task OnGetAsync() { CurrentUserRoles = new List <PairSelector>(); var roles = (await _IdentityRoleAppService.GetAllListAsync()) .Items.Where(x => x.IsPublic).Select(x => x.Name).ToList(); foreach (var role in roles) { CurrentUserRoles.Add(new PairSelector { Key = role, Value = false }); } UserAccount = new CreateAppUserDTO { Password = await _SettingProvider.GetOrNullAsync(PageSettingProvider.USER_CREATOR_DEFAULT_PASSWORD_FOR_NEW_USER) ?? "" }; }
public async Task <ActionResult <AppUserDTO> > PostAsync([FromBody] CreateAppUserDTO dto) { var item = await _userService.CreateAsync(dto); return(Ok(item)); }
public async Task <ActionResult <AppUserDTO> > PostAsync([FromBody] CreateAppUserDTO dto) { var item = await _appUsers.CreateAsync(dto.UserName, dto.FirstName, dto.LastName, dto.Email, dto.Password, dto.Roles); return(Ok(Mappers.GetAppUserDTO(item))); }