Exemple #1
0
        internal bool ItemExistInStore(Guid storeID, Guid itemID, MarketDbContext context)
        {
            IStoreInventoryManager storeInventory = GetAsInventoryManager(storeID, context);

            try
            {
                Item i = storeInventory.GetItemById(itemID);
                return(i != null);
            }
            catch (ItemNotFoundException)
            {
                return(false);
            }
        }
Exemple #2
0
        /// <summary>
        /// Return requested item.
        /// If item was not found ItemNotFoundException is thrown
        /// </summary>
        /// <param name="storeID"></param>
        /// <param name="itemId"></param>
        /// <returns> The requested item</returns>
        public Item GetItemByIdFromStore(Guid storeID, Guid itemId, MarketDbContext context)
        {
            IStoreInventoryManager store = storeHandler.GetStoreInventoryManager(storeID, context);

            return(store.GetItemById(itemId));
        }
Exemple #3
0
        internal bool CheckSufficentAmountInInventory(Guid storeID, Guid itemID, int amountToCheck, MarketDbContext context)
        {
            IStoreInventoryManager storeInventory = StoreHandler.GetStoreInventoryManager(storeID, context);

            return(storeInventory.GetItemById(itemID).Amount >= amountToCheck);
        }