public async System.Threading.Tasks.Task <string> getPrezziListino(String codiceArticolo) { string codiceAzienda = "AZ000001"; Console.WriteLine(codiceArticolo); Console.WriteLine("PASSO 2 A"); NameValueCollection restParams = new NameValueCollection { { "codiceAzienda", codiceAzienda }, { "codiceArticolo", codiceArticolo } }; var response = await RestFullConnection.GetAsync("api/listini/prezziarticolo", restParams); return(response.ToString()); }
public async System.Threading.Tasks.Task <string> getLista() { string codiceAzienda = "AZ000001"; NameValueCollection restParams = new NameValueCollection { { "codiceAzienda", codiceAzienda } }; var response = await RestFullConnection.GetAsync("api/prodotti", restParams); /*string strResponse = ""; * var client = new HttpClient(); * * client.DefaultRequestHeaders.Add("user-agent", "AdvaSoftMobile"); * client.DefaultRequestHeaders.Add("client_id", App.Configurazione.ClientId); * client.DefaultRequestHeaders.Add("Authorization", "Bearer " + App.Configurazione.Token); * * string link = RestFullConnection.APPLICATION_LINK + "api/prodotti?codiceAzienda=" + codiceAzienda; * Console.WriteLine(link); * var response = client.GetAsync(link).Result; * * if (response.IsSuccessStatusCode) * { * strResponse = await response.Content.ReadAsStringAsync(); * JObject jsonResponse = JObject.Parse(strResponse); * returnValue = JsonConvert.DeserializeObject<List<Prodotto>>(jsonResponse["data"].ToString()); * } * else * { * strResponse = await response.Content.ReadAsStringAsync(); * } * * Console.WriteLine(App.Configurazione.Token); * Console.WriteLine(strResponse);*/ return(response.ToString()); }