Beispiel #1
0
        /// <summary>
        /// добавление в корзину
        /// </summary>
        /// <param name="game">игра</param>
        /// <param name="quantity">количество</param>
        public void AddItem(BoardGame game, int quantity)
        {
            CartLine line = lineCollection
                            .Where(g => g.BoardGame.BoardGameId == game.BoardGameId)
                            .FirstOrDefault();

            if (line == null)
            {
                lineCollection.Add(new CartLine
                {
                    BoardGame = game,
                    Quantity  = quantity
                });
            }
            else
            {
                line.Quantity += quantity;
            }
        }
Beispiel #2
0
 /// <summary>
 /// удаление с корзині
 /// </summary>
 /// <param name="game"></param>
 public void RemoveLine(BoardGame game)
 {
     lineCollection.RemoveAll(l => l.BoardGame.BoardGameId == game.BoardGameId);
 }