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); } }
/// <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)); }
internal bool CheckSufficentAmountInInventory(Guid storeID, Guid itemID, int amountToCheck, MarketDbContext context) { IStoreInventoryManager storeInventory = StoreHandler.GetStoreInventoryManager(storeID, context); return(storeInventory.GetItemById(itemID).Amount >= amountToCheck); }