private async Task AddNewCandidato(Candidato candidato, CandidatoViewModel entity) { //var resultCandidato = await this.candidatoRepository.AddAsync(candidato) // .ConfigureAwait(false); var resultCandidato = await this.candidatoService.AddCandidatoAsync(candidato); var userIdentity = new CandidatoUser { UserName = entity.Email, CandidatoId = resultCandidato.Id, Email = entity.Email }; var password = this.configuracion.Configuration <string>("PwdNuevoCandidato"); var result = await this.userManager.CreateAsync(userIdentity, password) .ConfigureAwait(false); if (result.Succeeded) { var user = await this.userManager.FindByNameAsync(entity.Email) .ConfigureAwait(false); if (user == null) { return; } var urlApi = this.configuracion.Configuration <string>("UrlCandidatoAplicacion"); var forgotPasswordModel = new { email = user.Email, Alta = true }; await HttpRequestFactory.PostAsync($"{urlApi}api/Candidato/auth/ForgotPassword", forgotPasswordModel) .ConfigureAwait(false); } else { throw new Exception("Usuario duplicado."); } }