//metodo que captura os dados e retorna para a View
        public async Task <ActionResult> GetProdutos()
        {
            var api   = new ProdutoAPI(); //instancio a api com o metodo de captura
            var dados = await api.Get();

            return(Json(new { data = dados }, JsonRequestBehavior.AllowGet)); //retorno o json
        }
Esempio n. 2
0
    public void PreencherInfo(Desafio.Premio premio)
    {
        this.gameObject.SetActive(true);
        PnlInfo.SetActive(true);
        TxtValorPremio.text = Util.FormatarValores(premio.quantidade);

        if (string.IsNullOrEmpty(premio.produto))
        {
            TxtNomePremio.text = "CPGold";
            IconPremio.texture = ImgIconDinheiro;

            animarPnlInfo();
        }
        else
        {
            Dictionary <string, object> form = new Dictionary <string, object>()
            {
                { "produtoId", premio.produto }
            };

            StartCoroutine(ProdutoAPI.ObterProdutoCliente(form,
                                                          (response, error) =>
            {
                TxtNomePremio.text = response.nome;

                Main.Instance.ObterIcones(response.icon, FileManager.Directories.produto, (textura) =>
                {
                    if (textura = null)
                    {
                        IconPremio.texture = textura;
                        IconPremio         = Util.ImgResize(IconPremio, 180, 180);
                    }

                    animarPnlInfo();
                });
            }));
        }
    }