private void PovoaListaDePedidos() { string cpf = App.Current.Properties["Cpf_user"].ToString(); try { RelatorioClienteModel Resp = Service.Service.GetRelatorioCliente(cpf); if (Resp != null) { List <Rastreio> Lista = new List <Rastreio>((IEnumerable <Rastreio>)Resp.Pedidos); for (int i = 0; i < Lista.Count; i++) { ListaDePedidos.Add(Lista[i]); } } else { App.Current.MainPage.DisplayAlert("Atenção", "Carrinho vazio", "ok"); } } catch { App.Current.MainPage.DisplayAlert("Atenção", "ERRO", "ok"); } }
public static RelatorioClienteModel GetRelatorioCliente(string cpf) { string urlRelatorio = "https://ganhemais.site/api/RelatorioCliente.php?cpf={0}"; string NovoEnderecoURL = string.Format(urlRelatorio, cpf); WebClient wc = new WebClient(); string Conteudo = wc.DownloadString(NovoEnderecoURL); RelatorioClienteModel relatorio = JsonConvert.DeserializeObject <RelatorioClienteModel>(Conteudo); return(relatorio); }