Пример #1
0
        public Task Handle(AtualizarPerfilCommand message, CancellationToken cancellationToken)
        {
            if (!message.IsValid())
            {
                NotifyValidationErrors(message);
                return(Task.CompletedTask);
            }

            var perfil = new Perfil(message.Id, message.Nome, message.Situacao);

            _perfilRepository.Update(perfil);

            if (Commit())
            {
                Bus.RaiseEvent(new PerfilUpdatedEvents(perfil.Id, perfil.Nome, perfil.Situacao));
                return(Task.CompletedTask);
            }
            return(Task.CompletedTask);
        }
Пример #2
0
        public void Update(PerfilViewModel perfilViewModel)
        {
            var updateCommand = new AtualizarPerfilCommand(perfilViewModel.Id, perfilViewModel.Nome, perfilViewModel.Situacao);

            _bus.SendCommand(updateCommand);
        }
Пример #3
0
        public async Task <IActionResult> AtualizarPerfilAsync([FromBody] AtualizarPerfilCommand command)
        {
            var result = await _mediator.Send(command);

            return(this.VerificarErros(_notifications, result));
        }