public IActionResult ConfirmRemovePlan(int id, [FromServices] ConfirmRemovePlanViewModel model) { model.Plan = _planService.Get(id); if (model.Plan == null) { return(RedirectToAction("List")); } return(View(model)); }
public IActionResult RemovePlan([FromForm] ConfirmRemovePlanViewModel model) { try { _planService.Delete(model.PlanId); } catch { return(RedirectToAction("ConfirmRemovePlan", new { id = model.PlanId })); ; } return(RedirectToAction("List")); }