示例#1
0
        public async Task <CorTransfer> ConsultarPorId(int id)
        {
            CorService     corService;
            CorTransfer    cor;
            AutenticaModel autenticaModel;
            string         autorizacao;

            try {
                corService     = new CorService();
                autenticaModel = new AutenticaModel(httpContext);

                autorizacao = autenticaModel.ObterToken();

                cor = await corService.ConsultarPorId(id, autorizacao);
            } catch (Exception ex) {
                cor = new CorTransfer();

                cor.Validacao = false;
                cor.Erro      = true;
                cor.IncluirMensagem("Erro em CorModel ConsultarPorId [" + ex.Message + "]");
            } finally {
                corService     = null;
                autenticaModel = null;
            }

            return(cor);
        }