示例#1
0
        public async Task <IActionResult> Delete(Guid id)
        {
            if (id != Guid.Empty)
            {
                var expense = await _repo.Find <Expense>(id);

                _repo.Delete <Expense>(expense);

                if (await _repo.SaveAll())
                {
                    return(RedirectToAction("Index"));
                }
            }

            // TO:DO Give user feedback on error.
            return(RedirectToAction("Index"));
        }
示例#2
0
        public async Task <IActionResult> Delete(Guid id)
        {
            var saving = await _repo.Find <Saving>(id);

            if (saving == null)
            {
                return(NotFound());
            }

            _repo.Delete <Saving>(saving);

            if (await _repo.SaveAll())
            {
                return(RedirectToAction("Details", "SavingsGoal", new { id = saving.SavingsGoalId }));
            }

            return(RedirectToAction("Details", "SavingsGoal", new { id = saving.SavingsGoalId }));
        }
示例#3
0
        public async Task <IActionResult> Delete(Guid id)
        {
            if (id == null || id == Guid.Empty)
            {
                return(NotFound());
            }

            var category = await _repo.Find <Category>(id);

            _repo.Delete <Category>(category);

            if (await _repo.SaveAll())
            {
                return(RedirectToAction("Index"));
            }

            throw new Exception("Something went wrong while trying to delete the category");
        }
示例#4
0
        public async Task <IActionResult> Delete(Guid id)
        {
            var goal = await _repo.Find <SavingsGoal>(id);

            if (goal == null)
            {
                return(NotFound());
            }

            _repo.Delete <SavingsGoal>(goal);

            if (await _repo.SaveAll())
            {
                return(RedirectToAction("Goals"));
            }

            return(RedirectToAction("Goals"));
        }
        public async Task <IActionResult> Delete(Guid id)
        {
            var budget = await _repo.Find <Budget>(id);

            if (budget == null)
            {
                return(NotFound());
            }

            _repo.Delete <Budget>(budget);

            if (await _repo.SaveAll())
            {
                return(RedirectToAction("Index"));
            }

            throw new Exception("Something went wrong trying to delete this budget");
        }