public ActionResult DeleteExConfirmed(int id, int?ProjectSelect) { var item = CH.GetDataById <TargetOfMonth>(id); ViewBag.ProjectSelect = ProjectSelect; var pid = item.ProjectID; CH.Delete <TargetOfMonth>(id); var del = CH.GetAllData <TargetOfWeek>().Where(s => s.TargetOfMonthID == item.ID); if (del != null && del.Count() > 0) { CH.DeleteRange <TargetOfWeek>(del.ToList()); } return(RedirectToAction("TargetOfMonthForProject", "TargetOfMonth", new { ProjectSelect = ProjectSelect })); }