示例#1
0
        /// <summary>
        /// When an item in the food list is tapped, keep track of the count and add it to the AddItemsPopup list
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void FoodItemslv_ItemTapped(object sender, ItemTappedEventArgs e)
        {
            MiamiItem mItem = (MiamiItem)foodItemslv.SelectedItem;
            bool      check = false;

            if (popUpView.ItemData.Count == 0)
            {
                count = 0;
            }
            else
            {
                count = Int32.Parse(counterLabel.Text);
            }
            count++;
            counterLabel.Text = count.ToString();

            foreach (AddItemPopUpModel m in popUpView.ItemData)
            {
                if (m.Item.Equals(mItem))
                {
                    m.Count++;
                    check = true;
                    break;
                }
            }
            if (!check)
            {
                popUpView.ItemData.Add(new AddItemPopUpModel(mItem, 1));
            }
        }
示例#2
0
        /// <summary>
        /// Inserts an item that a user added into the UserEats table
        /// </summary>
        /// <param name="item"></param>
        async void InsertFoodForUser(MiamiItem item)
        {
            // uniqueId=string&offeredId=string&date=string
            if (item != null)
            {
                string date = ChangeDateToString(currentDate);
                string data = "uniqueId=" + unique_id + "&offeredId=" + item.Offered_id + "&date=" + date;

                await _restService.InsertFoodIntoUserEats(apiEndpoint + "UserEatFood", data);
            }
        }