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")); }
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 })); }
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"); }
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"); }