public ActionResult List(DateTime bDate, DateTime eDate, int codeID = 0, string SearchCode = "", string Requestor = "") { ViewBag.MinistryID = codeID; ViewBag.Requestor = Requestor; IEnumerable <calendar> CalendarList; if (SearchCode == "Ministry") { CalendarList = CalendarRepository.GetCalendarByMinistryDate(codeID, bDate.Date, eDate.Date); } else { CalendarList = CalendarRepository.GetCalendarByDateRangeActive(bDate.Date, eDate.Date); } foreach (calendar c in CalendarList) { c.EventTypeDesc = ConstantRepository.GetConstantID(c.EventType).Value1; if (c.ministryID != 0) { c.ministry = MinistryRepository.GetMinistryByID(c.ministryID); } } ViewBag.RecordCount = CalendarList.Count(); return(PartialView(CalendarList)); }