예제 #1
0
 public virtual CardInCardList AddCard(Card card, int quantity = 1, int number = 1)
 {
     var cardInList = CardInCardLists.FirstOrDefault(c => c.CardId == card.Id);
     if (cardInList == null)
     {
         cardInList = new CardInCardList {Card = card, CardList = this, Number = number, Quantity = quantity};
         CardInCardLists.Add(cardInList);
     }
     else
     {
         cardInList.Quantity += quantity;
     }
     return cardInList;
 }
예제 #2
0
        public virtual CardInCardList AddCard(Card card, int quantity = 1, int number = 1)
        {
            var cardInList = CardInCardLists.FirstOrDefault(c => c.CardId == card.Id);

            if (cardInList == null)
            {
                cardInList = new CardInCardList {
                    Card = card, CardList = this, Number = number, Quantity = quantity
                };
                CardInCardLists.Add(cardInList);
            }
            else
            {
                cardInList.Quantity += quantity;
            }
            return(cardInList);
        }