Esempio n. 1
0
        public async Task <object> GuardarProductos([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.GuardarProducto(producto);

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

                return(new HttpResponseMessage(HttpStatusCode.InternalServerError)
                {
                    Content = new StringContent(e.Message),
                    ReasonPhrase = e.Message
                });
            }
            return(response);
        }
 public ActionResult GuardarProducto(ProductoModel model)
 {
     _repo.GuardarProducto(PrepareProducto(model));
     return(Ok());
 }