Пример #1
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);
        }
Пример #2
0
        public bool HasAccountForStore(Store?store = null, Guid?storeId = null)
        {
            bool hasAccountForStore = false;

            if (storeId.HasValue && HasStore() && HasAccount())
            {
                hasAccountForStore = MyStores.Any(s =>
                                                  MyCardAccounts.Where(_ => _.Id == s.Id).FirstOrDefault() is object);
            }

            return(hasAccountForStore);
        }