public IActionResult Post([FromBody] Product newProduct) { try { productsService.AddProduct(newProduct); return(Ok()); }catch (Exception ex) { return(StatusCode(StatusCodes.Status500InternalServerError, "No se pudo agregar el producto")); } }
public IActionResult Post([FromBody] CommodityModel newCommodity) { try { productService.AddProduct(newCommodity); return(Ok()); } catch { throw new Exception("No se pudo agregar el producto."); } }