public IActionResult Get(int id)
        {
            VendaItemBO    vendaItemBO;
            VendaItemModel vendaItem;
            ObjectResult   response;

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

                vendaItemBO = new VendaItemBO(_loggerFactory, _config);

                vendaItem = vendaItemBO.Get(id);

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

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

            return(response);
        }
        public IActionResult Get()
        {
            VendaItemBO           vendaItemBO;
            List <VendaItemModel> enderecos;
            ObjectResult          response;

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

                vendaItemBO = new VendaItemBO(_loggerFactory, _config);
                enderecos   = vendaItemBO.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);
        }
        public IActionResult Put(int id, VendaItemModel vendaItem)
        {
            VendaItemBO  vendaItemBO;
            ObjectResult response;

            try
            {
                _log.LogInformation($"Starting Put( {id}, '{JsonConvert.SerializeObject(vendaItem, Formatting.None)}')");

                vendaItemBO = new VendaItemBO(_loggerFactory, _config);

                vendaItem.ID = id;
                vendaItem    = vendaItemBO.Update(vendaItem);

                response = Ok(vendaItem);

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

            return(response);
        }
        public IActionResult Post([FromBody] VendaItemModel vendaItem)
        {
            VendaItemBO  vendaItemBO;
            ObjectResult response;

            try
            {
                _log.LogInformation($"Starting Post('{JsonConvert.SerializeObject(vendaItem, Formatting.None)}')");

                vendaItemBO = new VendaItemBO(_loggerFactory, _config);

                vendaItem = vendaItemBO.Insert(vendaItem);

                response = Ok(vendaItem);

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

            return(response);
        }
        public IActionResult Delete(int id)
        {
            VendaItemBO  vendaItemBO;
            ObjectResult response;

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

                vendaItemBO = new VendaItemBO(_loggerFactory, _config);
                vendaItemBO.Delete(id);

                response = Ok(string.Empty);

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

            return(response);
        }