public IActionResult Index(int pageNumber = 1, int pageSize = 10) { var alertViewModel = _alertManager.GetOngoingAlerts() .Select(a => new AlertViewModel { Alert = a, PossibleActions = _alertManager.GetAlertPossibleActions(a) }) .OrderBy(a => a.Alert.ReceivedAt); var currentSchedule = _scheduleManager.GetCurrentSchedule(); var currentUserId = _userManager.GetUserId(User); var nextResponsible = _scheduleManager.GetNextPersonInCharge(currentSchedule?.Responsible); var viewModel = new AlertListViewModel { CurrentResponsibleIsLoggedUser = currentUserId == (currentSchedule?.Responsible?.Id?.ToString() ?? ""), CurrentResponsible = currentSchedule?.Responsible, CurrentResponsibleStatus = currentSchedule?.IsBusy, CurrentResponsibleStatusComment = currentSchedule?.BusyReason, CurrentResponsibleStartDate = currentSchedule?.StartAt, CurrentResponsibleEndDate = currentSchedule?.EndAt, Substitute = currentSchedule?.Substitute, NextResponsibleIsLoggedUser = currentUserId == (nextResponsible?.Id?.ToString() ?? ""), NextResponsible = nextResponsible, People = _personManager.GetPersonList().OrderBy(p => p.Name).ToList(), Alerts = new PagedList <AlertViewModel>(alertViewModel.AsQueryable(), pageNumber, pageSize) }; return(View(viewModel)); }