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