示例#1
0
        private async Task <LawofficeContext> ConfiguraGerenciador(LawofficeContext context, IGerenciadorDeRequisicoes gerenciador)
        {
            if (context == null)
            {
                context = (LawofficeContext)JsonConvert.DeserializeObject(Request.Headers[Parametros.TOKEN_CONTEXTO]);
            }

            return(context);
        }
示例#2
0
        public async Task <IActionResult> ListaFavorecimentos(int idContrato, LawofficeContext context = null)
        {
            context = await ConfiguraGerenciador(context, _gerenciadorDeRequisicoesDeFavorecimento);

            IFavorecimento[] favorecimentos = null;

            try
            {
                favorecimentos = await _gerenciadorDeRequisicoesDeFavorecimento.ListaFavorecimentosDeAsync(idContrato, Definicoes.ID_VINCULO_FAVORECIMENTO_CONTRATO);
            }
            catch (Exception ex)
            {
                return(BadRequest(ex));
            }

            return(Ok(favorecimentos));
        }
示例#3
0
        public async Task <IActionResult> ListaFavorecidosPorCategoria(int idContrato, LawofficeContext context = null)
        {
            context = await ConfiguraGerenciador(context, _gerenciadorDeRequisicoesDeFavorecimento);

            IFavorecimento[] favorecimentos = null;
            try
            {
                const string TIPO_FAVORECIMENTO = "FAVORECIMENTO_POR_CATEGORIA";
                favorecimentos = await _gerenciadorDeRequisicoesDeFavorecimento.ListarFavorecimentoPorCategoriaAsync(idContrato, Definicoes.ID_VINCULO_FAVORECIMENTO_CONTRATO, TIPO_FAVORECIMENTO);
            }
            catch (Exception Ex)
            {
                return(BadRequest(Ex));
            }
            return(Ok(favorecimentos));
        }