public ActionResult DeleteConfirmed(int MeetingAgendaID) { meetingagenda meetingagenda = MeetingAgendaRepository.GetAgendaByID(MeetingAgendaID); MeetingAgendaRepository.DeleteRecord(meetingagenda); return(RedirectToAction("List")); }
public ActionResult DeleteConfirmed(int MeetingID, DateTime ReturnBeginDate, DateTime ReturnEndDate, string ReturnSearchType = "", int ReturnCodeID = 0, string ReturnCode = "", string ReturnCallerType = "", string ReturnMethod = "") { try { meeting meeting = MeetingRepository.GetMeetingByID(MeetingID); calendar cal = CalendarRepository.GetCalendarByID(meeting.CalendarID); //delete meeting agendas IEnumerable <meetingagenda> agenda = MeetingAgendaRepository.GetAgendaByMeeting(MeetingID); if (agenda.Count() > 0) { foreach (var a in agenda) { MeetingAgendaRepository.DeleteRecord(a); } } //delete meeting attendees if (cal != null) { IEnumerable <attendance> attendance = AttendanceRepository.GetAttendanceByCalendar(cal.calendarID); if (attendance.Count() > 0) { foreach (var a in attendance) { AttendanceRepository.DeleteRecord(a); } } //delete meeting from calendar CalendarRepository.DeleteRecord(cal); } MeetingRepository.DeleteRecord(meeting); } catch (Exception ex) { TempData["Message2"] = string.Format("Error deleting meeting record."); } if (ReturnMethod == "AdminList") { return(RedirectToAction("AdminList", new { bDate = ReturnBeginDate, eDate = ReturnEndDate, SearchType = ReturnSearchType, codeID = ReturnCodeID, code = ReturnCode, CallerType = ReturnCallerType })); } else { return(RedirectToAction("List", new { bDate = ReturnBeginDate, eDate = ReturnEndDate, SearchType = ReturnSearchType, codeID = ReturnCodeID, code = ReturnCode })); } }