public async Task <AccountListResultsViewModel> Search(string query, int page, int pageSize = 20, OrderBy orderBy = OrderBy.Name, OrderDirection orderDirection = OrderDirection.ASC) { // We don't use the GetAccountListQuery in the controller method otherwise Swagger tries to use a POST on our GET call var accountListQuery = new GetAccountListQuery { PageSize = pageSize, OrderBy = orderBy, OrderDirection = orderDirection }; var result = await _mediator.Send(accountListQuery); return(result); //----------------------------------------------------- // Uses Azure Search //----------------------------------------------------- }
public async Task <AccountListResultsViewModel> List(int pageSize = 20, OrderBy orderBy = OrderBy.Name, OrderDirection orderDirection = OrderDirection.ASC, string continuationToken = null) { // We don't use the GetAccountListQuery in the controller method otherwise Swagger tries to use a POST on our GET call var accountListQuery = new GetAccountListQuery { PageSize = pageSize, OrderBy = orderBy, OrderDirection = orderDirection, ContinuationToken = continuationToken }; var result = await _mediator.Send(accountListQuery); return(result); //----------------------------------------------------- // TODO: DocumentDB will soon have skip/take // For now we use continuation token to get next batch from list // For even more robust query capabilities you should use the 'search' route //----------------------------------------------------- }
public async Task <List <AccountDetail> > Handle(GetAccountListQuery request, CancellationToken cancellationToken) { var accountEntities = await _accountRepository.GetAccountListAsync(); return(_mapper.Map <List <AccountEntity>, List <AccountDetail> >(accountEntities)); }