public ActionResult Create(ExpenseReport newExpense) { if (ModelState.IsValid) { if (newExpense.ItemId > 0) { expensesDataAccessLayer.UpdateExpense(newExpense); } else { expensesDataAccessLayer.AddExpense(newExpense); } } return(RedirectToAction("Index")); }
public ActionResult Create(ExpenseReport expenseReport) { if (ModelState.IsValid) { if (expenseReport.ItemId > 0) { expDataAccess.UpdateExpense(expenseReport); } else { expDataAccess.AddExpense(expenseReport); } } return(RedirectToAction(nameof(Index))); }