Exemplo n.º 1
0
        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));
        }
Exemplo n.º 2
0
        public ActionResult Index()
        {
            var model = new EventTypeIndexViewModel();

            model.EventTypes = _eventtypeRepository.GetAll();

            return(View(model));
        }
Exemplo n.º 3
0
        public ActionResult ModalSelect()
        {
            var model = new EventTypeIndexViewModel();

            model.EventTypes = _eventtypeRepository.GetAll();

            return(PartialView(model));
        }