예제 #1
0
 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"));
     }
 }
예제 #2
0
 public IActionResult Post([FromBody] CommodityModel newCommodity)
 {
     try
     {
         productService.AddProduct(newCommodity);
         return(Ok());
     }
     catch
     {
         throw new Exception("No se pudo agregar el producto.");
     }
 }