예제 #1
0
        public static bool Deduct(int itemId, int quantity)
        {
            bool success = false;

            Product product = ProductRetrieve(itemId);
            Order   items   = OrderRetrieve(product);


            if (items.Quantity >= quantity)
            {
                if (items.Quantity > quantity)
                {
                    OrderRepository.Update(product, quantity, false);
                    success = true;
                }
                else
                {
                    OrderRepository.Delete(items);
                    success = true;
                }
            }

            return(success);
        }
예제 #2
0
 public static bool CheckOut()
 {
     return(OrderRepository.ClearAll());
 }
예제 #3
0
 public static IEnumerable <Order> OrderRetrieveAll()
 {
     return(OrderRepository.RetrieveAll());
 }
예제 #4
0
 public static Order OrderRetrieve(Product item)
 {
     return(OrderRepository.Retrieve(item));
 }