public async Task <bool> Handle(ReceiveAlertCommand request, CancellationToken cancellationToken) { _alertRepository.Add(new Domain.AggregatesModel.AlertAggregate.Alert( request.Alerta, request.Host, request.Prioridade, request.Ambiente, request.Corretora, request.Equipe, request.Email_app, request.Criticidade, request.Status, Guid.NewGuid())); var result = await _alertRepository.UnitOfWork .SaveEntitiesAsync(cancellationToken); if (result) { var team = await _teamRepository.GetByEmailAsync(request.Email_app); var phone = team.GetMemberToCall(); if (phone == null) { var manager = await _managerRepository.GetAsync(team.ManagerId); phone = Convert.ToInt64(manager.Phone); } var code = await _followupAdapter.MakeCall(55, (long)phone); return(!string.IsNullOrEmpty(code)); } else { return(false); } }
public async Task <bool> Handle(MakeCallTeamMemberCommand request, CancellationToken cancellationToken) { await _followupAdapter.MakeCall(55, request.Phone); return(true); }