コード例 #1
0
 /// <summary>
 /// Delete purchase
 /// </summary>
 /// <param name="purchase">purchase to be deleted</param>
 public void DeletePurchase(PurchaseEntity purchase)
 {
     if (ReferenceEquals(purchase, null))
     {
         throw new ArgumentNullException($"{nameof(purchase)} must not be null");
     }
     try
     {
         purchaseService.Delete(purchase.ToDallPurchase());
     }
     catch (InvalidOperationException)
     {
         throw new PurchaseNotFoundException("No such purchase in the shop");
     }
 }
コード例 #2
0
 /// <summary>
 /// Delete product from the shop
 /// </summary>
 /// <param name="product">product to be deleted</param>
 public void DeleteProductFromShop(ProductEntity product)
 {
     if (ReferenceEquals(product, null))
     {
         throw new ArgumentNullException($"{nameof(product)} must not be null");
     }
     try
     {
         productService.Delete(product.ToDalProduct());
         productService.Commit();
     }
     catch (InvalidOperationException)
     {
         throw new ProductNotFoundException("No such product found in the shop");
     }
 }