public ActionResult Create([Bind(Include = "Id,Name,HouseAccountId,TransactionTypeId,BudgetItemId,EnteredById,Discription,Date,Amount,Reconciled,ReconciledAmount")] Transaction transaction) { if (ModelState.IsValid) { transaction.Reconciled = false; transaction.ReconciledAmount = 0.00M; transaction.Date = DateTime.Now; if (transaction.TransactionTypeId == 3) //Deposit { transactionsHelper.AddToAccount(transaction.HouseAccountId, transaction.Amount); //transactionsHelper.AddToBudgetItem(transaction.BudgetItemId, transaction.Amount); } else if (transaction.TransactionTypeId == 4) //Withdraw { //If amount is a negative number then the called functions will act accordingly. transactionsHelper.SubtractFromAccount(transaction.HouseAccountId, transaction.Amount); transactionsHelper.SubtractFromBudgetItem(transaction.BudgetItemId, transaction.Amount); if (transaction.Amount > 0) { transaction.Amount *= -1; } } db.Transactions.Add(transaction); db.SaveChanges(); return(RedirectToAction("Index", "Households")); } ViewBag.EnteredById = new SelectList(db.Users, "Id", "FirstName", transaction.EnteredById); ViewBag.HouseAccountId = new SelectList(db.HouseAccounts, "Id", "Name", transaction.HouseAccountId); ViewBag.TransactionTypeId = new SelectList(db.TransactionTypes, "Id", "Name", transaction.TransactionTypeId); return(View(transaction)); }