public PurchaseEntity GetPurchase(int id) { try { return(purchaseService.GetById(id).ToBalPurchase(productService)); } catch (ArgumentOutOfRangeException) { throw new PurchaseNotFoundException("No purchase was found"); } }
/// <summary> /// find product by id /// </summary> /// <param name="id">id of expected product</param> /// <returns>product</returns> public ProductEntity GetProduct(int id) { try { return(productService.GetById(id).ToBalProduct()); } catch (ArgumentOutOfRangeException) { throw new ProductNotFoundException("No product was found"); } }