public async Task <IActionResult> AddItemToCart(InventoryLineItem ili)
        {
            if (CurrentCustomer == null)
            {
                return(await LoginRedirectActionTask);
            }
            if (CurrentCart == null)
            {
                CurrentCart = new List <InventoryLineItem>();
            }

            InventoryLineItem processedILI = await GetProductForILIAsync(ili);

            List <InventoryLineItem> tempCart = CurrentCart;

            try
            {
                tempCart.Where(sli => sli.ProductId == processedILI.ProductId).First().ProductQuantity += 1;
            }
            catch (InvalidOperationException e)
            {
                var               message = e.Message;
                StagedLineItem    newSLI  = new StagedLineItem(processedILI.Product, 1, processedILI);
                InventoryLineItem newILI  = new InventoryLineItem(CurrentLocation, processedILI.Product, 1);
                tempCart.Add(newILI);
            }
            CurrentCart = tempCart;

            return(RedirectToAction("ViewInventoryAtLocation", new { locationId = CurrentLocation.Id }));
        }
        public CustomerLineItemQuantitySubMenu(ref InventoryLineItem selectedLineItem, ref OrderBuilder orderBuilder, ref IRepository repo) : base(ref repo)
        {
            Log.Logger.Information("Instantiated Customer Line Item Quantity Selection Submenu.");
            SelectedLineItem = selectedLineItem;
            selectedProduct  = selectedLineItem.Product;
            OrderBuilder     = orderBuilder;
            StagedLineItem stagedLineItem = OrderBuilder.GetStagedLineItemForAffectedLineItemIfItExists(selectedLineItem);

            if (stagedLineItem != null)
            {
                maxQuantity = stagedLineItem.GetNewQuantityOfAffectedInventoryLineItem();
            }
            else
            {
                maxQuantity = selectedLineItem.ProductQuantity;
            }
        }