Esempio n. 1
0
        public async Task <BalanceState> GetBalanceState()
        {
            var accounts = await _accountQueries.GetAll().ConfigureAwait(false);

            var flows = await _flowQueries.GetAll().ConfigureAwait(false);

            var balance = accounts.Sum(x => x.Balance) - accounts.Sum(x => x.AvailBalance) - flows.Sum(x => x.Balance);

            return(new BalanceState
            {
                ShowPrompt = balance != 0,
                Balance = balance
            });
        }
Esempio n. 2
0
        private async Task PrepareModels(int flowId)
        {
            Accounts = await _accountQueries.GetAll();

            if (flowId > 0)
            {
                Categories = await _categoriesQueries.GetFlowCategories(flowId);

                Products = await _productQueries.GetExpensesFlowProducts(flowId);
            }
            else
            {
                Categories = new List <CategoryModel>();
                Products   = new List <ProductModel>();
            }

            Flows = await _expenseFlowQueries.GetAll(true);
        }
Esempio n. 3
0
        private async Task PrepareModelsAsync()
        {
            BalanceState = await _inventorizationQueries.GetBalanceState();

            Flows = await _expenseFlowQueries.GetAll();
        }