public IActionResult Del(Unit unit) { var count = unitService.Del(unit.Unid); CaseService caseService = new CaseService(); CasedetailService detailservice = new CasedetailService(); var cases = caseService.QueryByUnid(unit.Unid); foreach (Thecase c in cases) { caseService.Del(c.Cid); detailservice.Del(c.Cid); } return(Redirect(Url.Action("Index", "_Unit"))); }
public IActionResult Del(Plan plan) { var planSerVice = new PlanService(); UnitService unitService = new UnitService(); CaseService caseService = new CaseService(); CasedetailService detailservice = new CasedetailService(); var units = unitService.QueryByPid(plan.Pid); foreach (Unit u in units) { unitService.Del(u.Unid); } var cases = caseService.QueryByPid(plan.Pid); foreach (Thecase c in cases) { caseService.Del(c.Cid); detailservice.Del(c.Cid); } var count = planSerVice.Del(plan.Pid); return(Redirect(Url.Action("Index", "_Plan"))); }