示例#1
0
        public ActionResult DeleteExpense(string id)
        {
            var expenseRepository = new ExpenseRepository();

            expenseRepository.DeleteExpense(Convert.ToInt32(id));

            return(RedirectToAction("ExpenseManager"));
        }
示例#2
0
        public IActionResult DeleteExpense(Guid id)
        {
            var accountId = HttpContext.Session.Get <long>(SessionHelper.SessionKeyAccountId);

            if (accountId == default)
            {
                return(RedirectToAction("Login", "Account", new { id = LoginHelper.BudgetApp }));
            }

            if (id == default || id == Guid.Empty)
            {
                return(RedirectToAction("ExpenseSummary", "Expense"));
            }

            ExpenseRepository.DeleteExpense(id);

            return(RedirectToAction("ExpenseSummary", "Expense"));
        }