コード例 #1
0
        public ActionResult Create()
        {
            // changes for associating dropdownlist- final

            Contact contact = new Contact();

            var accounts = _accountQueries.GetAll();

            contact.Accounts = accounts;

            var viewModel = _mapperForContact.MapToContactCreateViewModel(contact);

            return(View(viewModel));
        }
コード例 #2
0
        // GET: Account
        public ActionResult Index()
        {
            var accounts  = _accountQueries.GetAll();
            var viewModel = _mapperForAccount.MapToAccountViewModel(accounts);

            return(View(viewModel));
        }
コード例 #3
0
        public async Task OnGetAsync(int?fromId = null, int?toId = null)
        {
            Accounts = await _accountQueries.GetAll();

            Transfer = new Transfer();
            if (fromId != null)
            {
                var account = Accounts.SingleOrDefault(x => x.Id == fromId.Value);
                Transfer.AccountFrom = account?.Name;
                AvailableBalance     = account?.Balance.ToMoney();
            }
            else
            {
                AvailableBalance = "-";
            }

            if (toId != null)
            {
                Transfer.AccountTo = Accounts.SingleOrDefault(x => x.Id == toId.Value)?.Name;
            }
        }
コード例 #4
0
        public async Task OnGetAsync(int id, bool correcting = false, string returnPage = "./AccountsList")
        {
            var account = correcting ? null : await _accountQueries.GetById(id);

            Topup = new TopupAccount
            {
                Id          = id,
                Correcting  = correcting,
                AccountName = account?.Name,
                TopupDate   = _timeService.ClientLocalNow.ToStandardString(false),
                ReturnPage  = returnPage,
            };
            IncomeTypes = await _incomeTypeQueries.GetAll();

            Accounts = await _accountQueries.GetAll();

            if (correcting)
            {
                var balanceState = await _inventorizationQueries.GetBalanceState();

                Topup.Amount = balanceState.Balance.ToStandardString();
            }
        }
コード例 #5
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
            });
        }
コード例 #6
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);
        }
コード例 #7
0
        private async Task LoadModelsAsync(int expenseId)
        {
            Flow = await _expenseFlowQueries.GetById(expenseId);

            Accounts = await _accountQueries.GetAll();
        }
コード例 #8
0
ファイル: EditIncome.cshtml.cs プロジェクト: lulzzz/Monifier
        private async Task PrepareModelsAsync()
        {
            Accounts = await _accountQueries.GetAll();

            IncomeTypes = await _incomeTypeQueries.GetAll();
        }