public ActionResult Create(CreateViewModel model) { if (ModelState.IsValid) { BankAccount bankAccount = new BankAccount { Name = model.Name, Balance = model.Balance }; bankAccountRepository.InsertBankAccount(bankAccount); Fund fund = new Fund { Name = "What's Left", Balance = bankAccount.Balance, BankAccountId = bankAccount.BankAccountId }; fundRepository.InsertFund(fund); return RedirectToAction("Index"); } else { return View(model); } }
public ViewResult Create() { CreateViewModel model = new CreateViewModel() { Name = String.Empty, Balance = 0, }; return View(model); }