Exemplo n.º 1
0
        public bool AddCard(CardAccount userCard)
        {
            bool added = false;
            int  count;

            try
            {
                if (UserCards == null)
                {
                    UserCards = new List <CardAccount>();
                }

                userCard.MyUserId = Id;
                count             = UserCards.Count;
                UserCards.Add(userCard);

                if ((count + 1) == UserCards.Count)
                {
                    added = true;
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Exception in AddCard User: {ex.Message}");
                added = false;
            }

            return(added);
        }
Exemplo n.º 2
0
        public bool TryAddCard(CardAccount account)
        {
            uint start, end;
            bool isInserted;

            try
            {
                if (MyCardAccounts is null)
                {
                    MyCardAccounts = new List <CardAccount>();
                }

                start = (uint)MyCardAccounts.Count;
                MyCardAccounts.Add(account);
                end = (uint)MyCardAccounts.Count;

                isInserted = end > start ? true : false;
            }
            catch (Exception)
            {
                isInserted = false;
            }

            return(isInserted);
        }