public IHttpActionResult DebitCash(eMoney money)
 {
     if (_repository.DebitFunds(PaymentAmount.Money[money]))
     {
         return(Ok());
     }
     else
     {
         return(Content(HttpStatusCode.NotModified, "Negative payment is not allowed"));
     }
 }
        public IHttpActionResult Purchase(Product product)
        {
            bool     bPurchased       = false;
            IProduct inventoryProduct = new VendingMachineRepository.Models.Product(product.Id, 1, product.Price, product.Name);
            bool     bExists          = _repository.ProductExists(inventoryProduct);
            bool     bHasFunds        = _repository.Payment.Amount >= product.Price;

            if (bExists)
            {
                if (bHasFunds)
                {
                    bPurchased = _repository.DecreaseProductQuantity(inventoryProduct);
                }
            }

            if (!bExists)
            {
                return(Content(HttpStatusCode.NotFound, "Product is not in inventory."));
            }
            else if (!bHasFunds)
            {
                return(Content(HttpStatusCode.NotModified, "Funds are inadequate."));
            }
            else if (!bPurchased)
            {
                return(Content(HttpStatusCode.NotModified, "Product has insufficient quantity."));
            }
            else
            {
                _repository.DebitFunds(product.Price);
                return(Ok());
            }
        }