public async Task <object> ObterTipoTelefone() { var obterTipoTelefoneCommand = new ObterTipoTelefoneCommand(); var obterTipoTelefoneResponse = await _bus.SendCommand(obterTipoTelefoneCommand); return(_notifications.HasNotifications() ? obterTipoTelefoneResponse : _mapper.Map <IEnumerable <TipoTelefoneViewModel> >((IEnumerable <ParametrizacaoTipoTelefone>)obterTipoTelefoneResponse)); }
public async Task <object> Handle(ObterTipoTelefoneCommand message, CancellationToken cancellationToken) { if (!message.IsValid()) { NotifyValidationErrors(message); return(await Task.FromResult(false)); } try { var client = _httpAppService.CreateClient(_serviceManager.UrlVileve); return(await Task.FromResult(await _httpAppService.OnGet <IEnumerable <ParametrizacaoTipoTelefone> >(client, message.RequestId, "v1/dados-complementares/tipos-telefone"))); } catch (Exception e) { _logger.Log(LogLevel.Error, e, JsonSerializer.Serialize(new { message.RequestId, e.Message })); await _bus.RaiseEvent(new DomainNotification(message.MessageType, "O sistema está momentaneamente indisponível, tente novamente mais tarde.", message)); return(await Task.FromResult(false)); } }