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)); }
public async Task <CommandExecutionResult> HandleAsync(RemoveEmployeeAddressCommand command) { await _repository.RemoveAsync(new AddressForIdSpecification(command.AddressId)); return(CommandExecutionResult.Success); }