Ejemplo n.º 1
0
        public async Task <OrphanageDataModel.FinancialData.Account> GetAccount(int Aid)
        {
            using (var dbContext = new OrphanageDbCNoBinary())
            {
                var account = await dbContext.Accounts.AsNoTracking()
                              .Include(a => a.Bails)
                              .Include(b => b.Guarantors)
                              .FirstOrDefaultAsync(a => a.Id == Aid);

                if (account == null)
                {
                    return(null);
                }
                _selfLoopBlocking.BlockAccountSelfLoop(ref account);
                return(account);
            }
        }
Ejemplo n.º 2
0
        public async Task <IEnumerable <OrphanageDataModel.FinancialData.Account> > GetAccounts(int Uid)
        {
            IList <OrphanageDataModel.FinancialData.Account> accountsList = new List <OrphanageDataModel.FinancialData.Account>();

            using (var _orphanageDBC = new OrphanageDbCNoBinary())
            {
                var accounts = await _orphanageDBC.Accounts.AsNoTracking()
                               .Include(a => a.Bails)
                               .Include(b => b.Guarantors)
                               .Where(b => b.UserId == Uid)
                               .ToListAsync();

                foreach (var account in accounts)
                {
                    OrphanageDataModel.FinancialData.Account accountToFill = account;
                    _selfLoopBlocking.BlockAccountSelfLoop(ref accountToFill);
                    accountsList.Add(accountToFill);
                }
            }
            return(accountsList);
        }