コード例 #1
0
        public ActionResult GetByDescricao(string descricao)
        {
            ProdutoBE produtoBE = null;

            try
            {
                produtoBE = new ProdutoBE();

                var lst = produtoBE.Selecionar(new ProdutoVO {
                    Descricao = descricao
                });

                if (lst == null)
                {
                    return(NotFound());
                }

                return(Ok(lst));
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (produtoBE != null)
                {
                    produtoBE.FecharConexao();
                }
            }
        }
コード例 #2
0
        public ActionResult GetAll()
        {
            ProdutoBE produtoBE = null;

            try
            {
                produtoBE = new ProdutoBE();

                var lst = produtoBE.Selecionar();

                return(Ok(lst));
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (produtoBE != null)
                {
                    produtoBE.FecharConexao();
                }
            }
        }