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); }
public void Update(PerfilViewModel perfilViewModel) { var updateCommand = new AtualizarPerfilCommand(perfilViewModel.Id, perfilViewModel.Nome, perfilViewModel.Situacao); _bus.SendCommand(updateCommand); }
public async Task <IActionResult> AtualizarPerfilAsync([FromBody] AtualizarPerfilCommand command) { var result = await _mediator.Send(command); return(this.VerificarErros(_notifications, result)); }