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 }); }
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); }
private async Task PrepareModelsAsync() { BalanceState = await _inventorizationQueries.GetBalanceState(); Flows = await _expenseFlowQueries.GetAll(); }