Exemple #1
0
        protected async void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                try
                {
                    HttpResponseMessage response = client.GetAsync("chamadosResolvidos").Result;
                    var resultado = await response.Content.ReadAsStringAsync();

                    var lista = JsonConvert.DeserializeObject <Chamado[]>(resultado).ToList();

                    if (response.IsSuccessStatusCode)
                    {
                        IdChamadoDropDownList.DataSource     = lista;
                        IdChamadoDropDownList.DataTextField  = "Descricao";
                        IdChamadoDropDownList.DataValueField = "ChamadoId";
                        IdChamadoDropDownList.DataBind();
                    }
                }
                catch
                {
                    throw;
                }
            }
        }
Exemple #2
0
        protected async void ListarChamados()
        {
            HttpResponseMessage response = client.GetAsync("chamadosPendentes").Result;

            var resultado = await response.Content.ReadAsStringAsync();

            var lista = JsonConvert.DeserializeObject <Chamado[]>(resultado).ToList();

            chamado = JsonConvert.DeserializeObject <Chamado>(resultado);
            IdChamadoDropDownList.DataSource     = lista;
            IdChamadoDropDownList.DataTextField  = "ChamadoId";
            IdChamadoDropDownList.DataValueField = "ChamadoId";
            IdChamadoDropDownList.DataBind();
        }