public async Task <IActionResult> Register([FromBody] UserDTO userDTO) { var location = GetControllerActionNames(); try { var username = userDTO.EmailAddress; var password = userDTO.Password; _logger.LogInfo($"{location}: Registration Attempt for {username} "); var user = new ApplicationUser { Email = username, UserName = username }; var result = await _userManager.CreateAsync(user, password); if (!result.Succeeded) { foreach (var error in result.Errors) { _logger.LogError($"{location}: {error.Code} {error.Description}"); } return(InternalError($"{location}: {username} User Registration Attempt Failed")); } await _userManager.AddToRoleAsync(user, "Customer"); var ap = new ArtistProfile() { Id = Guid.NewGuid(), UserId = user.Id }; await _offerRepository.CreateArtistProfile(ap); return(Created("login", new { result.Succeeded })); } catch (Exception e) { return(InternalError($"{location}: {e.Message} - {e.InnerException}")); } }