/// <summary> /// add purchase to the shop /// </summary> /// <param name="purch">purchase to be added</param> public void RegisterPurchase(PurchaseEntity purch) { if (ReferenceEquals(purch, null)) { throw new ArgumentNullException($"{nameof(purch)} must not be null"); } purchaseService.Create(purch.ToDallPurchase()); purchaseService.Commit(); }
/// <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"); } }