Example #1
0
        public async Task <object> EditarProductos([FromBody] Producto producto)
        {
            object response = null;

            if (producto == null)
            {
                _log.Error(nameof(producto).ToString() + "Cannot be null.");
                throw new ArgumentNullException(nameof(producto), "Cannot be null.");
            }

            try
            {
                response = await _producto.EditarProducto(producto);

                _log.Information("Response from EditarProductos");
            }
            catch (Exception e)
            {
                _log.Error(e.ToString());

                return(new HttpResponseMessage(HttpStatusCode.InternalServerError)
                {
                    Content = new StringContent(e.Message),
                    ReasonPhrase = e.Message
                });
            }
            return(response);
        }