string BuildgoodEmployee() { var _random = new Random(); var identity = _random.Next(1, 10000000); var name = "fadynashat"; var address = new Address("el-shorta street", "assuit", "egypt"); var goodemp = new CreateEmployeePermanentCommand(identity, address, name, "01208844875"); return(JsonConvert.SerializeObject(goodemp)); }
public async Task <ActionResult> PostAsync([FromBody] CreateEmployeePermanentCommand employeeCommand) { bool commandResult = false; commandResult = await _mediator.Send(employeeCommand); if (!commandResult) { return(BadRequest()); } return(Ok()); }
/// <summary> /// Event handler which confirms that the grace period /// has been completed and order will not initially be cancelled. /// Therefore, the order process continues for validation. /// </summary> /// <param name="event"> /// </param> /// <returns></returns> public async Task Handle(EmployeePermanentCreatedIntegrationEvent @event) { using (LogContext.PushProperty("IntegrationEventContext", $"{@event.Id}-{Program.AppName}")) { _logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppName} - ({@IntegrationEvent})", @event.Id, Program.AppName, @event); var command = new CreateEmployeePermanentCommand(@event.EmpId); _logger.LogInformation( "----- Sending command: {CommandName} - {IdProperty}: {CommandId} ({@Command})", command.GetGenericTypeName(), nameof(command.EmpId), command.EmpId, command); await _mediator.Send(command); } }