Example #1
0
        public async Task <object> BorrarProductos([FromBody] Producto producto)
        {
            IEnumerable <Producto> 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.BorrarProducto(producto);

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

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