public ViewResult CreateFund(int id) { FundViewModel model = new FundViewModel() { Name = String.Empty, Balance = 0, BankAccountId = id }; return View(model); }
public ActionResult CreateFund(FundViewModel fundViewModel) { if (ModelState.IsValid) { // Maybe use mapper here like this // Product product = Mapper.Map<ProductViewModel, Product>(productViewModel); Fund fund = new Fund { Name = fundViewModel.Name, //Balance = fundViewModel.Balance, BankAccountId = fundViewModel.BankAccountId }; repo.InsertFund(fund); return RedirectToAction("Edit", new {accountId = fundViewModel.BankAccountId}); } else { return View(fundViewModel); } }