public async Task <APIUserDTO> SignUpAsync(APIUserDTO apiUserDTO) { if (apiUserDTO == null) { throw new NullParameterException(); } APIUser apiUser = new APIUser { UserName = apiUserDTO.UserName, Email = apiUserDTO.Email, UserTypeId = apiUserDTO.UserTypeId }; IdentityResult result = await _userManager.CreateAsync(apiUser, apiUserDTO.Password).ConfigureAwait(false); if (result.Errors.Any()) { apiUserDTO.ErrorMessages = result.Errors.ToList(); } return(apiUserDTO); }
public async Task <string> DeleteUserAsync(APIUserDTO aPIUserDTO) { if (aPIUserDTO == null) { throw new NullParameterException(); } await _signInManager.SignOutAsync().ConfigureAwait(false); APIUser apiUser = await _userManager.FindByNameAsync(aPIUserDTO.UserName).ConfigureAwait(false); if (apiUser != null) { await _userManager.DeleteAsync(apiUser).ConfigureAwait(false); return("Ok"); } else { return("Böyle bir kullanıcı yok!"); } }