//public BankAccount GetBankAccountById(int id)
 //{
 //    return context.Accounts.Where(a => a.BankAccountId == id).FirstOrDefault();
 //}
 //public void DeleteAccount(int accountId)
 //{
 //    BankAccount account = context.Accounts.Where(a => a.BankAccountId == accountId).FirstOrDefault();
 //    context.Accounts.Remove(account);
 //    context.SaveChanges();
 //}
 //public void InsertBankAccount(BankAccount bankAccount)
 //{
 //    context.Accounts.Add(bankAccount);
 //    context.SaveChanges();
 //}
 public void UpdateUser(User newUser)
 {
     User user = context.Users.Where(u => u.UserId == newUser.UserId).FirstOrDefault();
     user.NextPayDay = newUser.NextPayDay;
     context.SaveChanges();
 }
        public ActionResult Details(BankAccountViewModel model)
        {
            if (ModelState.IsValid)
            {
                BankAccount bankAccount = new BankAccount
                {
                    BankAccountId = model.BankAccountId,
                    Balance = model.Balance,
                    Name = model.Name
                };
                bankAccountRepository.UpdateBankAccount(bankAccount);

                User user = new User
                {
                    UserId = model.UserId,
                    NextPayDay = model.NextPayDay
                };
                userRepository.UpdateUser(user);

                return RedirectToAction("Details", new { accountId = model.BankAccountId });
            }
            else
            {
                return View(model);
            }
        }