コード例 #1
0
        /// <summary>
        /// Returns a list of Cart Items for order management
        /// </summary>
        /// <param name="restaurantID"></param>
        /// <param name="cartItems"></param>
        /// <returns></returns>
        public List <CartItems> CartDetailsCheck(int restaurantID, List <CartItemsReceiverDetails> cartItems)
        {
            try
            {
                List <CartItems> lstCartItems = new List <CartItems>();
                foreach (var item in cartItems)
                {
                    MenuItems menu = search_Repository.CartDetailsCheck(restaurantID, item.MenuId);

                    if (menu != null)
                    {
                        lstCartItems.Add(new CartItems()
                        {
                            MenuName        = menu.Item,
                            Quantity        = item.Quantity,
                            Price           = menu.Price,
                            IsItemAvailable = (item.Quantity < menu.Quantity) ? true : false
                        });
                    }
                }

                return(lstCartItems);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            //string serializedCartSenderItems = JsonConvert.SerializeObject(lstCartItems);
            //await _messenger.SendMessageAsync(serializedCartSenderItems);

            //RestaurantMenu menuObj = new RestaurantMenu();

            //menuObj.quantity = menu.quantity;
            // return 0;
        }