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)); }
// GET: Account public ActionResult Index() { var accounts = _accountQueries.GetAll(); var viewModel = _mapperForAccount.MapToAccountViewModel(accounts); return(View(viewModel)); }
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; } }
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(); } }
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 LoadModelsAsync(int expenseId) { Flow = await _expenseFlowQueries.GetById(expenseId); Accounts = await _accountQueries.GetAll(); }
private async Task PrepareModelsAsync() { Accounts = await _accountQueries.GetAll(); IncomeTypes = await _incomeTypeQueries.GetAll(); }