public async Task <IActionResult> Index(string filterLastNameFragment, int?filterDocumentType, int?filterRowStatus, bool isRequestDataImmediately = false) { ViewBag.IsUserConsultant = User.IsInRole("Приёмная комиссия (консультанты)") ? true : false; ViewBag.filterLastNameFragment = filterLastNameFragment; ViewBag.filterDocumentType = filterDocumentType; ViewBag.filterRowStatus = filterRowStatus; ViewBag.UserDocumentTypes = _selectListRepository.GetSelectListAbiturientsUserDocumentTypes(filterDocumentType ?? 0); ViewBag.RowStatuses = _selectListRepository.GetSelectListRowStatuses(filterRowStatus ?? 0); var userDocuments = _userDocumentRepository.GetUserDocuments() .Where(ud => ud.AppUser.Abiturient != null /*&& ud.AppUser.Abiturient.AbiturientStatusId == (int) AbiturientStatusEnum.ConfirmedAbiturient*/); if (!isRequestDataImmediately) { return(View()); } if (!string.IsNullOrWhiteSpace(filterLastNameFragment)) { userDocuments = userDocuments.Where(ud => ud.AppUser.LastName.Contains(filterLastNameFragment)); } if (filterDocumentType != null) { userDocuments = userDocuments.Where(ud => ud.FileDataTypeId == filterDocumentType); } if (filterRowStatus != null) { userDocuments = userDocuments.Where(ud => ud.RowStatusId == filterRowStatus); } return(View(await userDocuments.ToListAsync())); }