public IActionResult Add([FromBody] Product product)
 {
     if (product == null)
     {
         return(BadRequest());
     }
     _productCoreAPIRepository.AddProduct(product);
     if (!_productCoreAPIRepository.Save())
     {
         throw new Exception("failed to save product.");
     }
     return(CreatedAtRoute("GetProductByID", new { id = product.ID }, product));
 }
 public IActionResult Add(Error error)
 {
     if (error == null)
     {
         return(BadRequest());
     }
     _productCoreAPIRepository.AddError(error);
     _productCoreAPIRepository.Save();
     return(CreatedAtRoute("GetErrorByID", new { id = error.ID }, error));
 }