コード例 #1
0
        //Добавление товара в корзину
        public virtual void AddItem(Makdonalds makdonalds, int quantity)
        {
            MDCartLine line = lineCollection
                              .Where(p => p.Makdonalds.Id == makdonalds.Id).FirstOrDefault();

            if (line == null)
            {
                lineCollection.Add(new MDCartLine
                {
                    Makdonalds = makdonalds,
                    Quantity   = quantity
                });
            }
            else
            {
                line.Quantity += quantity;
            }
        }
コード例 #2
0
 //Удаление товара из корзины
 public virtual void RemoveLine(Makdonalds makdonalds) => lineCollection.RemoveAll(l => l.Makdonalds.Id == makdonalds.Id);