Exemplo n.º 1
0
        public bool write(BonusCard bonusCard)
        {
            List <BonusCard> bonusCards = getAllBonusCards();

            bonusCards.ForEach(bonusCard11 =>
            {
                if (bonusCard11.Id == bonusCard.Id)
                {
                    bonusCard11.Bonus = bonusCard.Bonus;
                }
            });
            JsonService.write(bonusCards, path);
            return(true);
        }
Exemplo n.º 2
0
        public void createBonusCard()
        {
            List <BonusCard> bonusCards   = getAllBonusCards();
            BonusCard        newBonusCard = new BonusCard();

            newBonusCard.Bonus = 0;
            if (bonusCards.Count == 0)
            {
                newBonusCard.Id = 1;
            }
            else
            {
                newBonusCard.Id = bonusCards[bonusCards.Count - 1].Id + 1;
            }

            bonusCards.Add(newBonusCard);
            JsonService.write(bonusCards, path);
        }
Exemplo n.º 3
0
 public List <BonusCard> getAllBonusCards()
 {
     return(JsonService.read <BonusCard>(path));
 }