コード例 #1
0
        void PopulateOrders()
        {
            if (App.CheckoutItems == null)
            {
                return;
            }

            var foodItems = App.CheckoutItems.GroupBy(p => p.Id);

            foreach (var item in foodItems)
            {
                var food = item.FirstOrDefault();

                if (food == null)
                {
                    continue;
                }

                var order = new OrderDetail {
                    FoodId       = food.Id,
                    FoodName     = food.Name,
                    Quantity     = item.Count(),
                    SellingPrice = food.PricePerQty,
                };

                CheckoutItems.Add(new OrderDetailsViewModel(order, this));
            }

            if (CheckoutItems.Count <= 0)
            {
                return;
            }

            TotalPrice = CheckoutItems.Sum(p => p.Details.TotalPrice);
        }
コード例 #2
0
        public void UpdateTotalPrice()
        {
            TotalPrice = CheckoutItems.Sum(p => p.Details.TotalPrice);

            CalculateDiscount();
        }