public async Task <IActionResult> EnrollProfile(Guid id, string locale) { var model = new EnrollVerificationProfile { Id = id }; model.VerificationPhrases = await AudioVerificationService.GetVerificationPhrases(locale); return(View(model)); }
public async Task <JsonResult> EnrollProfile(EnrollVerificationProfile model) { if (ModelState.IsValid) { var result = await AudioVerificationService.EnrollProfile(model); return(new JsonResult(result)); } return(new JsonResult(string.Empty)); }
public async Task <string> EnrollProfile(EnrollVerificationProfile model) { var url = $"{Configuration["AudioAnalyticsAPI"]}verificationProfiles/{model.Id}/enroll"; var key = Configuration["AudioAnalyticsKey"]; using (var inputStream = model.Audio.OpenReadStream()) { var response = await CognitiveServicesHttpClient.HttpPostAudio(inputStream, url, key); var responseBytes = await response.Content.ReadAsStringAsync(); return(responseBytes); } }