コード例 #1
0
        public IActionResult RentableBookItem(string barcode)
        {
            if (string.IsNullOrEmpty(barcode))
            {
                return(Content(""));
            }

            var inventoryItem = _inventoryProvider.FindInventoryItemByBarcode <Book>(barcode);

            if (inventoryItem == null)
            {
                inventoryItem = _inventoryProvider.FindInventoryItemByExternalId <Book>(barcode);
            }
            //TODO: write proper error handling, with error message on client site
            if (inventoryItem == null)
            {
                return(Content(""));
            }

            //TODO: show error if book is allready rented by someone else

            return(PartialView("_RentInventoryItem", inventoryItem));
        }