public void ValidarComando() { if (_notifications.TemNotificacao()) { throw new ScheduleIoException(_notifications.ObterNotificacoes().Select(x => x.Key + ": " + x.Value).ToList()); } }
public async Task <IActionResult> Adicionar(CadastrarLogPayload cadastrarLogPayload) { var logViewModel = _mapper.Map <LogViewModel>(cadastrarLogPayload); var usuarioId = (User.Identity as ClaimsIdentity)?.FindFirst(ClaimTypes.NameIdentifier).Value; logViewModel.UsuarioId = Guid.Parse(usuarioId); Guid.TryParse(cadastrarLogPayload.AmbienteId, out var ambienteId); logViewModel.AmbienteId = ambienteId; Guid.TryParse(cadastrarLogPayload.NivelId, out var nivelId); logViewModel.NivelId = nivelId; var id = await _logAppService.Adicionar(logViewModel); if (_notificationHandler.TemNotificacao()) { return(BadRequest(_notificationHandler.ObterNotificacoes())); } return(Ok(new { id })); }
public async Task <IActionResult> Cadastro([FromBody] CadastroFielViewModel cadastroFielViewModel) { await _fielAppService.CadastroFiel(cadastroFielViewModel); if (_domainNotificationHandler.TemNotificacao()) { var erros = _domainNotificationHandler.ListaErros(); _domainNotificationHandler.LimparNotification(); return(BadRequest(erros)); } return(CreatedAtAction(nameof(Cadastro), new { Login = cadastroFielViewModel.Login })); }
public async Task <IActionResult> CadastroProprietario([FromBody] CadastroProprietarioViewModel cadastroProprietarioViewModel) { await _proprietarioAppService.CadastroUsuario(cadastroProprietarioViewModel); if (_domainNotificationHandler.TemNotificacao()) { var erros = _domainNotificationHandler.ListaErros(); _domainNotificationHandler.LimparNotification(); return(BadRequest(erros)); } return(NoContent()); }
public void Handler_DeveAdicionarNotificacao() { var chave = "nome"; var valor = "Nome deve possuir conteúdo"; var notification = new DomainNotification(chave, valor); var notificationHandler = new DomainNotificationHandler(); notificationHandler.Handle(notification, CancellationToken.None); notificationHandler.TemNotificacao().Should().Be(true); notificationHandler.ObterNotificacoes().Should().HaveCount(1); var notificacaoLancada = notificationHandler.ObterNotificacoes().First(); notificacaoLancada.Should().NotBeEmpty(); }
public async Task <bool> Commit() { if (_domainNotifications.TemNotificacao()) { return(false); } var success = await _unitOfWork.Commit(); if (success) { return(true); } await _mediatorHandler.PublicarNotificacao(new DomainNotification("Commit", "Ocorreu um problema ao gravar dados.")); return(false); }
protected bool OperacaoValida() { return(!_notifications.TemNotificacao()); }
protected bool OperacaoValida() { return(!_DomainNotificationHandler.TemNotificacao()); }
protected bool OperacaoValida() => !_notification.TemNotificacao();