Example #1
0
        /// <summary>
        /// An item in the current shopping list has been swiped.
        /// If the item was flung then move all instances of the item to the basket
        /// If the item was justed swiped then move a single item to the basket.
        /// This may have the same effect depending on the number of instances of the item (its quantity)
        /// </summary>
        /// <param name="item"></param>
        /// <param name="wasFlung"></param>
        public static int CurrentItemSwiped(ListItem item, bool wasFlung)
        {
            IListService service = new ListService();

            int quantityToMove = (wasFlung == true) ? ( int )item.Quantity : 1;

            // Remove the specified number of instances of the item from the current list and add to the basket
            service.RemoveItemFromCurrentList(item.Id, quantityToMove);
            service.AddItemToBasketList(item.ItemId, quantityToMove);

            return(quantityToMove);
        }