public async Task <IActionResult> ClientOwnerSearch(SearchClientOwnerQuery query) { var builder = _builder.Property(nameof(ClientCommandBase.ClientOwnerId), "Client Owner", null) .Link(Url.AppLink(RelTypes.Action, "Clear", nameof(ClientOwnerClear), nameof(ClientController))) .Embedded(RelTypes.Search) .Property(nameof(SearchClientOwnerQuery.ClientOwnerNamePart), "", query.ClientOwnerNamePart) .Link(Url.AppLink(RelTypes.Self, "Search", nameof(ClientOwnerSearch), nameof(ClientController))); var employees = await _clientService.HandleAsync(query); foreach (var employee in employees.Result) { builder.Link(Url.AppLink(RelTypes.Action, employee.LongName, nameof(ClientOwnerSelect), nameof(ClientController), new SelectClientOwnerQuery(employee.EmployeeId))); } var vm = new SelectVm(_builder.Build()); return(PartialView("SelectPartialView", vm)); }
public async Task <QueryExecutionResult <IEnumerable <EmployeeEntity> > > HandleAsync(SearchClientOwnerQuery query) { var employees = await _repository.PageAsync(new EmployeesWithNameLikeSpecification(query.ClientOwnerNamePart), 10, 0); var queryExecutionResult = new QueryExecutionResult <IEnumerable <EmployeeEntity> >(employees); return(queryExecutionResult); }