public async Task <string> AnalyzeWebPage(DocumentSearchQueryViewModel vm) { CheckValidityOfData(vm.documents); using (HttpClient client = new HttpClient()) { client.BaseAddress = new Uri(BaseAddress); HttpResponseMessage response = await client.PostAsJsonAsync <DocumentSearchQueryViewModel>("analyzeSentiment", vm); HttpContent content = response.Content; string jsonStringResult = await content.ReadAsStringAsync(); //the string will be serialized in the Ok() method in the controller return(jsonStringResult); } }
public async Task <ActionResult> Analyze(DocumentSearchQueryViewModel vm) { string stringyfiedResult = await webScrapService.AnalyzeWebPage(vm); return(Ok(stringyfiedResult)); }