public async Task <QueryExecutionResult <EmployeeEntity> > HandleAsync(RemoveEmployeeAddressQuery query) { var employeeEntity = await _repository.FirstAsync(new EmployeeWithIdSpecification(query.EmployeeId)); var queryExecutionResult = new QueryExecutionResult <EmployeeEntity>(employeeEntity); return(queryExecutionResult); }
public async Task <IActionResult> RemoveAddress(RemoveEmployeeAddressQuery query, RemoveEmployeeAddressCommand command) { await _employeeService.HandleAsync(command); await _notificationService.HandleAsync(new CreateNotificationCommand(query.EmployeeId, "The address is removed from the employee address list.")); var queryExecutionResult = await _employeeService.HandleAsync(query); var vm = BuildAddressesVm(queryExecutionResult.Result, new SearchEmployeeAddressQuery()); return(PartialView(vm)); }
private string RemoveAddressUri(RemoveEmployeeAddressQuery query) => Url.AppUri(nameof(RemoveAddress), nameof(EmployeeController), query);