public async Task <IActionResult> Index(GetProvidersForFeedbackRequest request, int pageIndex = PagingState.DefaultPageIndex) { var idClaim = HttpContext.User.FindFirst(System.Security.Claims.ClaimTypes.NameIdentifier); var pagingState = await _sessionService.Get <PagingState>($"{idClaim.Value}_PagingState"); if (null == pagingState) { pagingState = new PagingState(); } pagingState.PageIndex = pageIndex; await _sessionService.Set($"{idClaim.Value}_PagingState", pagingState); var model = await _trainingProviderService.GetTrainingProviderSearchViewModel( request.EncodedAccountId, pagingState.SelectedProviderName, pagingState.SelectedFeedbackStatus, pagingState.PageSize, pagingState.PageIndex, pagingState.SortColumn, pagingState.SortDirection); model.ChangePageAction = nameof(Index); ViewBag.EmployerAccountsHomeUrl = _urlBuilder.AccountsLink("AccountsHome", request.EncodedAccountId); await _sessionService.Set($"{idClaim.Value}_ProviderCount", model.TrainingProviders.TotalRecordCount); return(View(model)); }
public async Task Valid_AccountId_Should_Return_View() { // Arrange var request = new GetProvidersForFeedbackRequest(); // Act var result = await _controller.Index(request) as ViewResult; // Assert var viewData = _controller.ViewData; Assert.Single(viewData); }