Пример #1
0
        public void RemoveFromCart(int MobileId)
        {
            if (items == null)
            {
                return;
            }
            var        dao    = new MobileDAO();
            MobileItem Mobile = dao.GetMobileItem(MobileId);

            if (items.ContainsKey(Mobile))
            {
                items.Remove(Mobile);
            }
        }
Пример #2
0
        public void AddToCart(int MobileId)
        {
            var        dao    = new MobileDAO();
            MobileItem Mobile = dao.GetMobileItem(MobileId);

            if (items == null)
            {
                items = new Dictionary <MobileItem, int>();
            }
            if (items.ContainsKey(Mobile))
            {
                int quantity = items[Mobile];
                items[Mobile] = ++quantity;
            }
            else
            {
                items[Mobile] = 1;
            }
        }