public IActionResult Index() { var viewmodel = new CustomerAccountsViewModel { Accounts = BankRepository.Accounts, Customers = BankRepository.Customers }; return(View(viewmodel)); }
public IActionResult Index() { var model = new CustomerAccountsViewModel(); model.Customers = _repository.Customers; foreach (var customer in model.Customers) { customer.Accounts = _repository.Accounts.Where(a => a.AccountHolder == customer.Id).ToList(); } return(View(model)); }