public IActionResult Delete(int id) { Plan plan = _planRepository.GetPlanById(id); _planRepository.DeletePlan(plan); return(RedirectToAction("index")); }
public IActionResult Delete([FromBody] Plan plan) { var result = _repo.DeletePlan(plan); if (result == null) { return(NotFound($"There is no plan with specified ID: {plan.Id}")); } return(Ok(result)); }
public IActionResult DeletePlan(int planId) { _loggerManager.Info($"DeletePlan({planId}) is requested"); if (planId <= 0) { _loggerManager.Info($"DeletePlan({planId}) is a bad request"); return(BadRequest()); } var result = _planRepository.DeletePlan(planId); if (result) { _loggerManager.Info($"DeletePlan({planId}) successfully deleted a plan"); } else { _loggerManager.Info($"DeletePlan({planId}) is unable to delete a plan"); } return(new JsonResult(new { result })); }