Ejemplo n.º 1
0
        public IActionResult Get(int id)
        {
            VendaBO      vendaBO;
            VendaModel   venda;
            ObjectResult response;

            try
            {
                _log.LogInformation($"Starting Get( {id} )");

                vendaBO = new VendaBO(_loggerFactory, _config);

                venda = vendaBO.Get(id);

                if (venda != null)
                {
                    response = Ok(venda);
                }
                else
                {
                    response = NotFound(string.Empty);
                }

                _log.LogInformation($"Finishing Get( {id} )");
            }
            catch (Exception ex)
            {
                _log.LogError(ex.Message);
                response = StatusCode(500, ex.Message);
            }

            return(response);
        }
Ejemplo n.º 2
0
        public IActionResult Get()
        {
            VendaBO           vendaBO;
            List <VendaModel> enderecos;
            ObjectResult      response;

            try
            {
                _log.LogInformation("Starting Get()");

                vendaBO   = new VendaBO(_loggerFactory, _config);
                enderecos = vendaBO.Get();

                response = Ok(enderecos);

                _log.LogInformation($"Finishing Get() with '{enderecos.Count}' results");
            }
            catch (Exception ex)
            {
                _log.LogError(ex.Message);
                response = StatusCode(500, ex.Message);
            }

            return(response);
        }