public IActionResult Deposit(TransactionsViewModel model) { var customerList = _bankRepo.GetAllCustomers().SelectMany(y => y.BankAccounts); var customerAccount = customerList.Where(x => x.AccountId == model.BankAccount.AccountId).SingleOrDefault(); if (customerAccount == null) { ViewBag.Message = "The accountnumber is invalid, please enter another number."; return(View("DepositAndWithdraw", model)); } if (model.Amount == 0) { ViewBag.Message = "Please enter an amount higher than 0 SEK."; return(View("DepositAndWithdraw", model)); } if (model.Amount > 0) { _bankRepo.DepositAmount(model.Amount, customerAccount); model.BankAccount.Balance = customerAccount.Balance; ViewBag.Message = "You have successfully made a deposit!"; return(View("Verification", model)); } return(View(model)); }