Esempio n. 1
0
    protected void CargarMarcas()
    {
        ddlMarcas.Items.Add(new ListItem("Todas", "0"));

        foreach (Marca x in mMarcaService.GetMarcas())
        {
            ddlMarcas.Items.Add(new ListItem(x.Descripcion));
        }
    }
        public async Task <ResponseModel <List <MarcaModel> > > GetMarcas()
        {
            ResponseModel <List <MarcaModel> > response = new ResponseModel <List <MarcaModel> >();

            try
            {
                MarcaService      marcaService = new MarcaService();
                List <MarcaModel> marcas       = await marcaService.GetMarcas();

                response.Value = marcas;
            }
            catch (Exception ex)
            {
                response.Erro         = true;
                response.MensagemErro = ex.Message;
            }

            return(response);
        }