public async Task <IActionResult> Index(string sortOrder, string searchString, int page = 1) { searchString = searchString.ToLowerRemoveSymbols(); IEnumerable <EventType> eventTypes = await _eventService.EventTypes.GetEventTypesWithEventsAsync(searchString, page, PageSize); int totalItems = 0; if (!string.IsNullOrEmpty(searchString)) { Expression <Func <EventType, bool> > predicate = (x => (string.IsNullOrEmpty(searchString) || x.EventTypeName.ToLower().Contains(searchString))); totalItems = _eventService.EventTypes.CountByExpression(predicate); } else { totalItems = _eventService.EventTypes.Count(); } EventTypeIndexViewModel vm = new EventTypeIndexViewModel( eventTypes, sortOrder, searchString, totalItems, page, PageSize ); ViewData["ActiveMenu"] = "Admin"; ViewData["ActiveLink"] = "EventTypeIndex"; ViewData["Title"] = "Event Type Index"; return(View(vm)); }
public ActionResult Index() { var model = new EventTypeIndexViewModel(); model.EventTypes = _eventtypeRepository.GetAll(); return(View(model)); }
public ActionResult ModalSelect() { var model = new EventTypeIndexViewModel(); model.EventTypes = _eventtypeRepository.GetAll(); return(PartialView(model)); }