public async Task <IActionResult> CreateAgentIntigrationEmail([FromBody] CreateAgentIntigrationEmailAccountCommand createAgentIntigrationEmailAccountCommand) { var result = await mediator.Send(createAgentIntigrationEmailAccountCommand); return(result ? (IActionResult)Ok(result) : (IActionResult)BadRequest()); }
public async Task <bool> Handle(CreateAgentIntigrationEmailAccountCommand createAgentIntigrationEmailAccountCommand, CancellationToken cancellationToken) { var agent = await queryExecutor.Execute <GetAgentQuery, Agent>(new GetAgentQuery() { AgentId = createAgentIntigrationEmailAccountCommand.AggregateId }); agent.UpdateMailbox(createAgentIntigrationEmailAccountCommand.MailboxName); await mediator.DispatchDomainEventsAsync(agent); return(true); }