public ActionResult List(DateTime bDate, DateTime eDate, string SearchType = "", int codeID = 0, string code = "", int codeID2 = 0) { IEnumerable <responsibility> ResponsibilityList; if (SearchType == "StaffSearch") { ResponsibilityList = ResponsibilityRepository.GetResponsibilityByStaff(codeID); } else if (SearchType == "StatusSearch") { ResponsibilityList = ResponsibilityRepository.GetResponsibilityByStatus(code); } else { ResponsibilityList = ResponsibilityRepository.GetResponsiblityByDateRange(bDate, eDate); } ViewBag.RecordCount = ResponsibilityList.Count(); return(PartialView(ResponsibilityList)); }
public ActionResult DeleteConfirmed(int StaffID) { staff staff = StaffRepository.GetStaffByID(StaffID); if (staff.pictureID > 0) { picture pic = PictureResponsibility.GetPictureByID((int)staff.pictureID); PictureResponsibility.DeleteRecord(pic); } IEnumerable <responsibility> duties = ResponsibilityRepository.GetResponsibilityByStaff(StaffID); foreach (responsibility r in duties) { ResponsibilityRepository.DeleteRecord(r); } StaffRepository.DeleteRecord(staff); return(RedirectToAction("Details")); }