public async Task <IActionResult> Edit(UpdateClientQuery query) { var commandExecutionResult = await _clientService.HandleAsync(query); var vm = BuildEditForm(commandExecutionResult.Result); return(View("FormView", vm)); }
public async Task <QueryExecutionResult <ClientEntity> > HandleAsync(UpdateClientQuery query) { var clientEntity = await _repository.FirstAsync(new ClientWithIdSpecification(query.ClientId)); var queryExecutionResult = new QueryExecutionResult <ClientEntity>(clientEntity); return(queryExecutionResult); }
public async Task <IActionResult> Edit(UpdateClientQuery query, UpdateClientCommand command) { if (ModelState.IsValid == false) { var vm = BuildEditForm(command.Adapt <ClientEntity>()); return(View("FormView", vm)); } await _clientService.HandleAsync(command); return(Redirect(Url.AppUri(nameof(Edit), nameof(ClientController), new UpdateClientQuery(command.ClientId)))); }